每日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 文本属性. 一.文本阴影 ...
随机推荐
- 一个定时任务管理器,基于Go语言和beego框架开发
链接 https://github.com/lisijie/webcron 安装说明 系统需要安装Go和MySQL. 获取源码 $ go get github.com/lisijie/webcron ...
- Pytest学习(十一)- 失败重跑插件pytest-rerunfailures的使用
环境依赖 Python 3.5, 最高 3.8, or PyPy3 pytest 5.0或更高版本 插件安装 pip3 install pytest-rerunfailures -i http://p ...
- Windows10通过NFS挂载linux目录
大致分为以下三大步骤: 一.启动NFS服务器 二.启动NFS客户端 三.挂载NFS目录 工具: win10.虚拟机Ubuntu18.0系统 一. 启动linux的NFS服务端: 以下均为Ubuntu操 ...
- C++重复结构题解
买房子 总时间限制: 1000ms 内存限制: 65536kB 描述 某程序员开始工作,年薪N万,他希望在中关村公馆买一套60平米的房子,现在价格是200万,假设房子价格以每年百分之K增长,并且该 ...
- Appium上下文和H5测试(二)
坚持原创输出,点击蓝字关注我吧 作者:清菡 博客:oschina.云+社区.知乎等各大平台都有. 文章总览图 一.往期回顾 loc='new UiSelector().text("全程班&q ...
- synchronized底层揭秘
前言 上篇文章我们从硬件级别探索,对可见性和有序性的认识上升了一个高度,却迟迟没有介绍原子性的解决方案. 今天我们就来聊一聊原子性的解决方案,锁. 引入锁机制,除了可以保证原子性,同时也可以保证可见性 ...
- Python爬虫入门(二)之Requests库
Python爬虫入门(二)之Requests库 我是照着小白教程做的,所以该篇是更小白教程hhhhhhhh 一.Requests库的简介 Requests 唯一的一个非转基因的 Python HTTP ...
- 冲刺随笔——Day_Ten
这个作业属于哪个课程 软件工程 (福州大学至诚学院 - 计算机工程系) 这个作业要求在哪里 团队作业第五次--Alpha冲刺 这个作业的目标 团队进行Alpha冲刺 作业正文 正文 其他参考文献 无 ...
- [oBIX包使用教程] 使用 Python 通过 oBIX 协议访问 Niagara 数据
oBIX 全称是 Open Building Information Exchange,它是基于 RESTful Web Service 的接口的标准,用于构建控制系统.oBIX是在专为楼宇自动化设计 ...
- 第11.10节 Python正则表达式的非贪婪模式的重复匹配:'*?', '+?',和 '??'
在<第11.9节 Pytho正则表达式的贪婪模式和非贪婪模式>老猿简单介绍了贪婪模式和非贪婪模式,并说明'', '+',和 '?' 修饰符都是 贪婪的:它们在字符串进行尽可能多的匹配.有时 ...