文字闪烁效果 CSS

写在前面

好好学习,天天向上!

效果图

绝美的效果

实现过程

  1. 先给没字体添加一些普通的样式,颜色设置为透明
  2. 给文字设置一个动画效果,通过text-shadow属性来实现变亮的效果,同时通过透明色和白色的切换实现文字闪烁的效果
  3. 给每个字设置一定的动画延时,从而实现流水的效果

代码部分

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的更多相关文章

  1. css动画 文字闪烁效果

    /*定义页面基础CSS*/ body{ font-family: 'microsoft yahei',Arial,sans-serif; color: #EFEFEF; background: #22 ...

  2. css文字闪烁效果

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  3. 文字分列 CSS属性

    column 这里有一系列新的CSS属性,可以帮助你很轻松的实现文字的多列布局.让我们瞧瞧: .three-column { padding: 1em; -moz-column-count: 3; - ...

  4. 省略文字的css

    在显示一行文字时,如果容器太小,为了显示出省略字符,可以使用 ellipsis { white-space: nowrap; overflow: hidden; text-overflow: elli ...

  5. 文本框文字垂直居中 CSS

    <html> <head> <style type="text/css"> #text { height:20px; vertical-alig ...

  6. 文字描边css

    -webkit-text-stroke: 3.3px #2A75BF; -webkit-text-fill-color:#fff; 该方法在安卓端貌似不支持,显示为一团 或: -webkit-text ...

  7. 点亮文字(CSS)

    html <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8& ...

  8. 两边是线 ,中间是文字 的CSS写法 而且还是自适应的

  9. 一段隐藏文字的css代码,记录下

    <span style="width:1px; height:1px; color:#fff; outline-width:hidden; overflow:hidden; displ ...

随机推荐

  1. 【Azure 环境】在Windows系统中 使用Terraform创建中国区Azure资源步骤(入门级)

    Terraform(全称:Hashicorp Terraform )是一种开源工具,用于预配和管理云基础结构. 它将基础结构编入描述云资源拓扑的配置文件中. 这些资源包括虚拟机.存储帐户和网络接口等. ...

  2. 一次使用IDEA中HTTP Client的经历

    1 开端 HTTP Client是IDEA中自带的一个插件,用于代替原来的REST Client,打开Tools->HTTP Client->Test RESTful Web Servic ...

  3. Weblogic CVE-2020-2551漏洞复现

    Weblogic CVE-2020-2551漏洞复现 0x00 前言 在一次渗透测试过程中,碰见了该漏洞,并使用在野的POC验证了这个漏洞存在,当时工具网传的利用方式去进行利用,没有成功,可能是自己太 ...

  4. 基于Docker安装的MindSpore-1.2 GPU版本

    技术背景 在前面一篇博客中,我们介绍过MindSpore-CPU版本的Docker部署以及简单的案例测试,当时官方还不支持GPU版本的Docker容器化部署.经过MindSpore团队的努力,1.2. ...

  5. 【工具类】获取请求头中User-Agent工具类

    public class AgentUserKit { private static String pattern = "^Mozilla/\\d\\.\\d\\s+\\(+.+?\\)&q ...

  6. 【运维--系统】nacos介绍和安装

    目录: 简介 安装java 安装mysql 安装nacos 附录 简介 Nacos 致力于帮助您发现.配置和管理微服务.Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现.服务配置.服 ...

  7. Python脚本暴力破解SSH口令以及构建僵尸网络(pxssh)

    目录 暴力破解SSH口令 SSH远端执行命令 构建僵尸网络 环境:Kali Linux  python 2.7.13 暴力破解SSH口令 Pxssh是pexpect库的ssh专用脚本,他能用预先写好的 ...

  8. Windows PE 第一章开发环境和基本工具使用

    第一章 Windows PE 基本工具 1.1开发语言MASM32 1.1.1设置开发环境 这个不细说了,我在整理Intel汇编的时候详细的说了环境搭建以及细节.地址是:http://blog.csd ...

  9. 汇编环境搭建(vs2010(2012)+masm32)

    我本地使用的环境VS2012(2010)+MASM32,下面的图是在网上找的几个博客拼在一起的,用的是vs2010,但是并不影响.(所有文件我都打包好了,如果懒的话可以直接下载这个包)地址是:http ...

  10. Django(5)django配置信息

    前言 Django的配置文件settings.py用于配置整个网站的环境和功能,核心配置必须有项目路径.密钥配置.域名访问权限.App列表.中间件.资源文件.模板配置.数据库的连接方式 基本配置信息 ...