文字闪烁效果 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. Spring Boot超简单的测试类demo

    1 概述 Spring Boot结合Junit的简单测试类demo,流程是先引入依赖,接着编写测试类测试运行即可. 2 依赖 <dependency> <groupId>org ...

  2. 002-Java的标识符和关键字

    目录 一.标识符 1.什么是标识符 2.标识符的命名规则 3.标识符的命名规范 二.关键字 1.什么是关键字 2.Java中的关键字 一.标识符 1.什么是标识符   标识符就是程序员自己规定的代表一 ...

  3. JDBC_08_解决SQL注入问题 (登录和注册)

    解决SQL注入问题 只要用户提供的信息不参与sql语句的编译过程,那么尽管用户输入的信息中含有sql关键字那么也不会起作用了 要想使用户提供信息不参与sql语句的编译过程,那么必须使用 java.sq ...

  4. Day09_41_集合_Set

    Set集合 Set集合 - Set集合的特点是无序不可重复.Set集合类似于一个罐子,程序可以依次把多个对象"丢进"Set集合,而Set集合通常不能记住元素的添加顺序. - Set ...

  5. k8s ingress-nginx

    转载自https://blog.csdn.net/bjwf125/article/details/104663542/ Kubernetes系列之Kubernetes使用ingress-nginx作为 ...

  6. 使用IDEA模拟git命令使用的常见场景

    目录 使用IDEA模拟git命令使用的常见场景 前期准备 新建一个远程仓库 在一个文件夹内建立两个子文件夹作为两个本地仓库的存放位置 本地仓库与远程仓库建立联系 模拟两个用户协同开发的场景(使用IDE ...

  7. php常用错误码的意思

    总揽 200:服务器响应正常. 304:该资源在上次请求之后没有任何修改(这通常用于浏览器的缓存机制,使用GET请求时尤其需要注意). 400:无法找到请求的资源. 401:访问资源的权限不够. 40 ...

  8. springboot 配置将info、error、debug 分别输出到不同文件

    在resource下创建名为 logback-spring.xml 的配置文件,内容如下: <?xml version="1.0" encoding="UTF-8& ...

  9. TP5 验证-内置规则

    系统内置的验证规则如下: 格式验证类 require 验证某个字段必须,例如: 'name'=>'require' number 或者 integer 验证某个字段的值是否为数字(采用filte ...

  10. adbi学习:java hook实现机制

    adbi的java hook实现代码ddi不在之前下载的文件中,下载地址:https://github.com/crmulliner/ddi,具体的编译看readme里面很详细的介绍了.注意ddi代码 ...