文字闪烁效果 CSS + HTML
文字闪烁效果 CSS
写在前面
好好学习,天天向上!
效果图
绝美的效果


实现过程
- 先给没字体添加一些普通的样式,颜色设置为透明
- 给文字设置一个动画效果,通过text-shadow属性来实现变亮的效果,同时通过透明色和白色的切换实现文字闪烁的效果
- 给每个字设置一定的动画延时,从而实现流水的效果
代码部分
HTML
<div>
<span>b</span>
<span>l</span>
<span>a</span>
<span>c</span>
<span>k</span>
<span>p</span>
<span>i</span>
<span>n</span>
<span>k</span>
</div>
CSS
body {
background-color: black;
}
div {
margin: 200px auto;
width: 1000px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 120px;
color: transparent;
}
span {
animation: shan 4s linear infinite;
text-transform: uppercase;
}
div span:nth-child(1){
animation-delay: 0s;
}
div span:nth-child(2){
animation-delay: .4s;
}
div span:nth-child(3){
animation-delay: .8s;
}
div span:nth-child(4){
animation-delay: 1.2s;
}
div span:nth-child(5){
animation-delay: 1.6s;
}
div span:nth-child(6){
animation-delay: 2s;
}
div span:nth-child(7){
animation-delay: 2.4s;
}
div span:nth-child(8){
animation-delay: 2.8s;
}
div span:nth-child(9){
animation-delay: 3.2s;
}
@keyframes shan {
0% ,100%{
color: white;
text-shadow: 0 0 4px pink ,
0 0 10px pink ,
0 0 20px pink ,
0 0 30px pink ,
0 0 40px pink ,
0 0 50px pink ,
0 0 60px pink ,
0 0 70px pink ,
0 0 80px pink ,
0 0 90px pink ,
0 0 100px pink;
}
30%,90% {
color: transparent;
text-shadow: none;
}
}
完整代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>字体闪烁效果</title>
<style>
body {
background-color: black;
}
div {
margin: 200px auto;
width: 1000px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 120px;
color: transparent;
}
span {
animation: shan 4s linear infinite;
text-transform: uppercase;
}
div span:nth-child(1){
animation-delay: 0s;
}
div span:nth-child(2){
animation-delay: .4s;
}
div span:nth-child(3){
animation-delay: .8s;
}
div span:nth-child(4){
animation-delay: 1.2s;
}
div span:nth-child(5){
animation-delay: 1.6s;
}
div span:nth-child(6){
animation-delay: 2s;
}
div span:nth-child(7){
animation-delay: 2.4s;
}
div span:nth-child(8){
animation-delay: 2.8s;
}
div span:nth-child(9){
animation-delay: 3.2s;
}
@keyframes shan {
0% ,100%{
color: white;
text-shadow: 0 0 4px pink ,
0 0 10px pink ,
0 0 20px pink ,
0 0 30px pink ,
0 0 40px pink ,
0 0 50px pink ,
0 0 60px pink ,
0 0 70px pink ,
0 0 80px pink ,
0 0 90px pink ,
0 0 100px pink;
}
30%,90% {
color: transparent;
text-shadow: none;
}
}
</style>
</head>
<body>
<div>
<span>b</span>
<span>l</span>
<span>a</span>
<span>c</span>
<span>k</span>
<span>p</span>
<span>i</span>
<span>n</span>
<span>k</span>
</div>
</body>
</html>
真正的才智是刚毅的志向。 —— 拿破仑
文字闪烁效果 CSS + HTML的更多相关文章
- css动画 文字闪烁效果
/*定义页面基础CSS*/ body{ font-family: 'microsoft yahei',Arial,sans-serif; color: #EFEFEF; background: #22 ...
- css文字闪烁效果
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- 文字分列 CSS属性
column 这里有一系列新的CSS属性,可以帮助你很轻松的实现文字的多列布局.让我们瞧瞧: .three-column { padding: 1em; -moz-column-count: 3; - ...
- 省略文字的css
在显示一行文字时,如果容器太小,为了显示出省略字符,可以使用 ellipsis { white-space: nowrap; overflow: hidden; text-overflow: elli ...
- 文本框文字垂直居中 CSS
<html> <head> <style type="text/css"> #text { height:20px; vertical-alig ...
- 文字描边css
-webkit-text-stroke: 3.3px #2A75BF; -webkit-text-fill-color:#fff; 该方法在安卓端貌似不支持,显示为一团 或: -webkit-text ...
- 点亮文字(CSS)
html <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8& ...
- 两边是线 ,中间是文字 的CSS写法 而且还是自适应的
- 一段隐藏文字的css代码,记录下
<span style="width:1px; height:1px; color:#fff; outline-width:hidden; overflow:hidden; displ ...
随机推荐
- 005-Java中的控制语句
目录 一.控制语句 一.作用 二.分类 二.选择语句(分支语句) 一.if 语句 二.switch语句 三.循环语句 一.for循环 二.while循环(while循环的循环次数是:0~n次) 三.d ...
- 安卓to鸿蒙系列:Timber
目录 Guide 原理 知识点 移植到鸿蒙 Guide 本文基于https://gitee.com/andych008/timber_ohos 分析Timber的源码,及移植到鸿蒙需要做的工作. 大神 ...
- 重绘DevExpress的XtraMessageBox消息提示框控件
先来看提示框,可以看到框其实是一个去掉最大化.最小化按钮后的窗体,窗体的内容就是我们想要提示的内容,重绘提示框其实就是重绘窗体以及中间部分的内容. 首先重绘窗体,消息提示框的窗体不是XtraForm而 ...
- 1075 PAT Judge
The ranklist of PAT is generated from the status list, which shows the scores of the submissions. Th ...
- 轮子:DateUtil.java
日期工具类 import java.text.SimpleDateFormat; import java.util.Date; public class DateUtil { public stati ...
- 『动善时』JMeter基础 — 6、使用JMeter发送一个最基础的请求
目录 步骤1:创建一个测试计划 步骤2:创建线程组 步骤3:创建取样器 步骤4:创建监听器 步骤5:完善信息 步骤6:保存测试计划 步骤7:查看结果 总结:JMeter测试计划要素 当我们第一次打开J ...
- hdu3338 最大流
题意: 给你一个N*M的网格,上面有的有一些数字,要求填充数字,满足的规则是这样: 答案不唯一,只要满足和的关系就可以,还有就是只能用1--9之间的数字填充,而且每一行或一列可 ...
- Android APK程序的smali动态调试
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/71250622 一.Apktool的下载和安装 Apktool是Android逆向分 ...
- Python第一章-基础知识
第一章:基础知识 1.1 安装python. 直接官网下载最新的python然后默认安装就可以了,然后开始菜单里找到pyhton *.*.* Shell.exe运行python的交互shell ...
- 无线网络的加密方式:WEP、WPA和WPA2
目录 有线等效加密( WEP ) Wi-Fi 访问保护( WPA ) Wi-Fi 访问保护 II( WPA2 ) WPA-PSK/WPA2-PSK 无线网标准 有线等效加密( WEP ) 有线等效保密 ...