效果演示

实现了一个文字模糊消失的效果,包括一个容器(.container)和一个标题(h2)。标题中的文字由多个span元素组成,通过鼠标悬停实现逐个消失的效果。整个容器背景颜色为黑色,使文字效果更加突出。
Code
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>波浪式模糊文字特效</title>
<link rel="stylesheet" href="./40-波浪式模糊文字特效.css">
</head>
<body>
<div class="container">
<h2>
<span>听</span>
<span>若</span>
<span>冰</span>
<span>说</span>
<span>C</span>
<span>S</span>
<span>S</span>
</h2>
</div>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
}
.container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
background-color: #212121;
}
h2 {
display: flex;
font-size: 160px;
color: #fff;
text-align: center;
text-transform: uppercase;
cursor: pointer
}
h2 span {
transition: 1.5s;
}
h2:hover span {
filter: blur(20px);
opacity: 0;
transform: scale(2);
}
h2 span:nth-child(1) {
transition-delay: 0.1s;
}
h2 span:nth-child(2) {
transition-delay: 0.2s;
}
h2 span:nth-child(3) {
transition-delay: 0.3s;
}
h2 span:nth-child(4) {
transition-delay: 0.4s;
}
h2 span:nth-child(5) {
transition-delay: 0.5s;
}
h2 span:nth-child(6) {
transition-delay: 0.6s;
}
h2 span:nth-child(7) {
transition-delay: 0.7s;
}
h2 span:nth-child(8) {
transition-delay: 0.8s;
}
h2 span:nth-child(9) {
transition-delay: 0.9s;
}
h2 span:nth-child(10) {
transition-delay: 1s;
}
实现思路拆分
* {
margin: 0;
padding: 0;
}
这段代码是设置所有元素的外边距和内边距为0。
.container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
background-color: #000;
}
这段代码是设置容器的高度为100vh,使用flex布局,使其水平和垂直居中。同时设置overflow为hidden,使其超出部分隐藏。并且设置背景颜色为黑色。
h2 {
display: flex;
font-size: 160px;
color: #fff;
text-align: center;
text-transform: uppercase;
cursor: pointer
}
这段代码是设置标题的布局方式为flex,并且使其水平和垂直居中。同时设置字体大小为160px,颜色为白色,文本对齐方式为居中,文本转换为大写,鼠标指针为手型。
h2 span {
transition: 1.5s;
}
这段代码是设置标题中每个字母的过渡效果为1.5s。
h2:hover span {
filter: blur(20px);
opacity: 0;
transform: scale(2);
}
这段代码是设置当鼠标悬停在标题上时,标题中每个字母的模糊程度为20px,透明度为0,缩放为原来的2倍。
h2 span:nth-child(1) {
transition-delay: 0.1s;
}
h2 span:nth-child(2) {
transition-delay: 0.2s;
}
h2 span:nth-child(3) {
transition-delay: 0.3s;
}
h2 span:nth-child(4) {
transition-delay: 0.4s;
}
h2 span:nth-child(5) {
transition-delay: 0.5s;
}
h2 span:nth-child(6) {
transition-delay: 0.6s;
}
h2 span:nth-child(7) {
transition-delay: 0.7s;
}
h2 span:nth-child(8) {
transition-delay: 0.8s;
}
h2 span:nth-child(9) {
transition-delay: 0.9s;
}
h2 span:nth-child(10) {
transition-delay: 1s;
}
这段代码是设置标题中每个字母的过渡延迟时间,使其逐个消失。第一个字母的过渡延迟时间为0.1s,第二个字母的过渡延迟时间为0.2s,以此类推。
匿名
2025-10-22
盖楼盖楼!
匿名
2025-08-11
沙发沙发
匿名
2025-08-10
https://at.oiik.cn/bing.html
匿名
2025-02-21
实用,我在开发https://minmail.app/时候使用到了
王飞翔
2024-12-30
亲爱的朋友:您好!中国疫情持续蔓延,很多人症状非常严重持久不愈,医院人满为患,各年龄段随地倒猝死的现象暴增,多省感染手足口、甲流、乙流、支原体、合胞及腺病毒的儿童不断攀升,目前各种天灾人祸,天气异象频发。古今中外的很多预言都说了这几年人类有大灾难,如刘伯温在预言中说 “贫者一万留一千,富者一万留二三”,“贫富若不回心转,看看死期到眼前”, 预言中也告诉世人如何逃离劫难的方法,真心希望您能躲过末劫中的劫难,有个美好的未来,请您务必打开下方网址认真了解,内有躲避瘟疫保平安的方法。网址1:https://github.com/1992513/www/blob/master/README.md?abhgc#1 网址2:bitly.net/55bbbb 网址3:https://d3ankibxiji86m.cloudfront.net/30gj 如打不开请多换几个浏览器试
匿名
2024-12-12
Backdata 搜索引擎网址提交入口:https://backdata.net/submit-site.html