每日CSS_发光文本效果
每日CSS_发光文本效果
2020_12_22

1. 代码解析
1.1 html 代码片段
<h1>
<span>今</span>
<span>天</span>
<span>你</span>
<span>开</span>
<span>心</span>
<span>吗</span>
</h1>
在里面定义6个字, 分别用不同的 span 表示, 供单个使用
1.2 css 代码片段
- 首先对 body 进行初始化
body{
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #000;
font-family: 幼圆, cursive;
}
在 body 中设置布局方式为 flex, 将内容居中显示, 设置高度为 100%, 宽度为 auto , 自然为 100%, 背景设为黑色.
- 初始化字体颜色及大小
h1{
margin: 0;
padding: 0;
color: #111;
font-size: 10em;
}
设置字体颜色为 #111, 效果如下

- 设置动画和字体摆放方式
h1 span{
display: table-cell;
margin: 0;
padding: 0;
animation: animate 2s linear infinite;
}
设置了摆放方式是 table-cell , 字体更加紧密并且间距相同, 设置动画, 线性无限放.
- 动画设置
@keyframes animate {
0%, 100%{
color: #ffffff;
filter: blur(2px);
text-shadow: 0 0 10px #5655ff,
0 0 20px #5655ff,
0 0 40px #5655ff,
0 0 80px #5655ff,
0 0 120px #5655ff,
0 0 200px #5655ff,
0 0 300px #5655ff,
0 0 400px #5655ff;
}
5%, 95%{
color: #111;
filter: blur(0px);
text-shadow: none;
}
}
设置动画, 每个字体的变化方式是从白色到暗黑再到白色, 使用 blur 实现了模糊效果, 效果如下

- 轮流开始播放动画
h1 span{
display: table-cell;
margin: 0;
padding: 0;
animation: animate 2s linear infinite;
}
h1 span:nth-child(1){
animation-delay: 0s;
}
h1 span:nth-child(2){
animation-delay: 0.25s;
}
h1 span:nth-child(3){
animation-delay: 0.5s;
}
h1 span:nth-child(4){
animation-delay: 0.75s;
}
h1 span:nth-child(5){
animation-delay: 1s;
}
h1 span:nth-child(6){
animation-delay: 1.25s;
}
共6个字, 每个字拥有一定的延时, 从第一个一直到最后一个, 每个字体显示时间是 0.25s
2. 源码
2.1 html 代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="2020_12_22.css">
</head>
<body>
<h1>
<span>今</span>
<span>天</span>
<span>你</span>
<span>开</span>
<span>心</span>
<span>吗</span>
</h1>
</body>
</html>
2.2 css 代码
body{
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #000;
font-family: 幼圆, cursive;
}
h1{
margin: 0;
padding: 0;
color: #111;
font-size: 10em;
}
h1 span{
display: table-cell;
margin: 0;
padding: 0;
animation: animate 2s linear infinite;
}
h1 span:nth-child(1){
animation-delay: 0s;
}
h1 span:nth-child(2){
animation-delay: 0.25s;
}
h1 span:nth-child(3){
animation-delay: 0.5s;
}
h1 span:nth-child(4){
animation-delay: 0.75s;
}
h1 span:nth-child(5){
animation-delay: 1s;
}
h1 span:nth-child(6){
animation-delay: 1.25s;
}
@keyframes animate {
0%, 100%{
color: #ffffff;
filter: blur(2px);
text-shadow: 0 0 10px #5655ff,
0 0 20px #5655ff,
0 0 40px #5655ff,
0 0 80px #5655ff,
0 0 120px #5655ff,
0 0 200px #5655ff,
0 0 300px #5655ff,
0 0 400px #5655ff;
}
5%, 95%{
color: #111;
filter: blur(0px);
text-shadow: none;
}
}
每日CSS_发光文本效果的更多相关文章
- 每日CSS_实时时钟效果
每日CSS_实时时钟效果 2020_12_22 源码链接 1. 代码解析 1.1 html 代码片段 <div class="clock"> <div class ...
- 每日CSS_霓虹灯按钮悬停效果
每日CSS_霓虹灯按钮悬停效果 2020_12_20 1. 代码解析 1.1 html 代码片段解析 <a href="#"> <span></spa ...
- 每日CSS_滚动页面动画效果
每日CSS_滚动页面动画效果 2021_1_13 源码链接 1. 代码解析 1.1 html 代码片段 <section> <h2>开 始 滑 动</h2> < ...
- CSS文本效果
前面的话 本文将详细介绍CSS文本效果 凸版印刷效果 这种效果尤其适用于中等亮度背景配上深色文字的场景:但它也可用于深色底.浅色字的场景,只要文字不是黑色并且背景不是纯黑或纯白就行 [浅色背景深色文本 ...
- 每日CSS_纯CSS制作进度条
每日CSS_纯CSS制作进度条 2020_12_26 源码 1. 代码解析 1.1 html 代码解析 设置整个容器 <div class="container"> . ...
- CSS 3学习——文本效果和@font-face
文本效果 关于文本效果,这里仅仅记录得到大多数浏览器支持的几个属性,分别是: text-overflow text-shadow word-break word-wrap text-overflow ...
- CSS3常用属性(边框、背景、文本效果、2D转换、3D转换、过渡、有过渡效果大图轮播、动画)
CSS3边框: 1.CSS3圆角:border-radius 属性--创建边框线的圆角 <body style="font-size:24px; color:#60F;"& ...
- 推荐20款基于 jQuery & CSS 的文本效果插件
jQuery 和 CSS 可以说是设计和开发行业的一次革命.这一切如此简单,快捷的一站式服务.jQuery 允许你在你的网页中添加一些真正令人惊叹的东西而不用付出很大的努力,要感谢那些优秀的 jQue ...
- 第 21 章 CSS3 文本效果
学习要点: 1.文本阴影 2.文本裁剪 3.文本描边 4.文本填充 主讲教师:李炎恢 本章主要探讨 HTML5 中 CSS3 中文本效果,其中也包含一些之前讲过的 CSS3 文本属性. 一.文本阴影 ...
随机推荐
- FL studio系列教程(三):如何用FL Studio做电音
电音制作,自然少不了适合做电音的软件,市面上可以进行电音制作的软件不少,可是如果在这些软件中只能选择一款的话,想必多数人会把票投给FL Studio,毕竟高效率是永远不变的真理,今天就让我们来看看如何 ...
- pip更新报错问题
pip更新错误如下: WARNING: You are using pip version 20.1.1; however, version 20.2 is available. You should ...
- 分享:经常说你精通C语言,看看这十道题你会不会解!
今天给大家分享我们在日常工作中可能遇到的疑问,不看答案,你是否有把握都能答对?让我们来试试吧~ 一.会输出"hello-std-out"? 参考答案: stdout和stder ...
- kafka入门之broker--通信协议
kafka的通讯协议是基于tcp之上的二进制协议,所有类型的请求和响应都是结构化的,由不同的初始类型构成.kafka使用这组协议完成各个功能的实现. 单个kafka client通常需要同时连接多个b ...
- dubbo 多注册中心
这个我调试了下,多个注册中心在创建代理的时候,每个注册中心对应一个invoker,持有一个RegistryDirectory对应一个zkClinet,并且维护这样一个map: 那些不正确zk在创建代理 ...
- VUE中,@click后边( ) 有无括号的区别
在使用的时候,两种方式结果效果差不多是一样. @click="Login()" @click="Login"而唯一的区别就是,有括号的可以在括号里写传递的参数. ...
- kali putty远程连接允许以root身份登录
原文链接:https://blog.csdn.net/long_long_chuang/article/details/70227874 kali linux通过ssh+putty来实现远程登录(亲测 ...
- moviepy音视频剪辑:headblur的参数r_blur卷积核以及fx、fy、r_zone的功能作用及用途
☞ ░ 前往老猿Python博文目录 ░ 在moviepy1.03版本中,headblur的调用语法为:headblurbak(clip,fx,fy,r_zone,r_blur=None) 其中参数f ...
- 第15.23节 PyQt(Python+Qt)入门学习:Model/View架构中QListView视图配套Model的开发使用
老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 一.概述 QListView理论上可以和所有QAbstractItemModel派生的类如QStri ...
- js- 判断属性是否 属于该对象 hasOwnProperty()
var obj ={ name:'suan', sex :'male', age:150, height:185, characeter:true, _proto_:{ lastName:'susan ...