文字闪烁效果 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 ...
随机推荐
- Hadoop完整搭建过程(一):本地模式
1 本地模式 本地模式是最简单的模式,所有模块都运行在一个JVM进程中,使用本地文件系统而不是HDFS. 本地模式主要是用于本地开发过程中的运行调试用,下载后的Hadoop不需要设置默认就是本地模式. ...
- kubernetes CRD
官方文档:https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions ...
- 善用k8s describe
使用 kubectl describe 来查看某个东西的详细例如 kubectl describe deployment my-nginx kubectl describe svc my-nginx
- 【Azure 应用服务】备份网站时由于文件太大了,导致应用服务备份失败。如何解决?
问题描述 备份网站时由于文件太大了,导致应用服务备份失败.如何解决呢? 问题分析 App Service (应用服务)的备份功能有10GB大小的限制,超过了是无法备份成功的并且该限制是无法扩大的.查看 ...
- Relatives(容斥)
Relatives Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15708 Accepted: 7966 Descri ...
- hdu4845 状态压缩BFS
题意: 给一个n*m的矩阵,从11,走到nm,格子和格子之间可能有墙,也可能有门,有的格子上面有钥匙,相应的钥匙开相应的们,捡钥匙和开门都不需要时间,问你最少多少部能走到nm. 思路: ...
- Python2中的urllib、urllib2和 Python3中的urllib、requests
目录 Python2.x中 urllib和urllib2 常用方法和类 Python3.x中 urllib requests Python2.x中 urllib和urllib2 urllib 和 ur ...
- hdu 4891 模拟
题意: 给你一个串,问你有几种意思,有两个规则 (1) { } 答案乘以 ({}之间"|"的个数 + 1) (2) && 答案乘以 (&a ...
- Apache Tomcat examples directory vulnerabilities(Apache Tomcat样例目录session操纵漏洞)复现
目录 Session操控漏洞 示例: Session操控漏洞 在Apache tomcat中,有一个默认的example示例目录,该example目录中存着众多的样例,其中/examples/serv ...
- PhotoShop 第一课 功能认识
功能认识 1.基本界面 可以对各工具栏进行编辑,对工具/栏目进行勾选添加和整合并搭建自己的专属操作页面. 2.画布设置 拍照或者画画都需要一个东西来呈现这个东西叫做画布(可以通过导航栏-文件-新建画布 ...