新增第112个小实例:纯CSS实现文本背景扫光效果
This commit is contained in:
parent
3e06d737cb
commit
50abb7af30
|
@ -115,4 +115,5 @@
|
|||
108. HTML5+CSS3+JS小实例:漂亮的导航栏动画效果
|
||||
109. HTML5+CSS3小实例:灵动的文字loading加载特效
|
||||
110. HTML5+CSS3小实例:百看不腻的旋转loading动画
|
||||
111. HTML5+CSS3+JQuery小实例:DIY切换衣服图案
|
||||
111. HTML5+CSS3+JQuery小实例:DIY切换衣服图案
|
||||
112. HTML5+CSS3小实例:纯CSS实现文本背景扫光效果
|
|
@ -0,0 +1,38 @@
|
|||
*{
|
||||
/* 初始化 */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body{
|
||||
height: 100vh;
|
||||
/* 弹性布局 水平+垂直居中 */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #000;
|
||||
}
|
||||
h1{
|
||||
/* 文本透明 */
|
||||
color: transparent;
|
||||
font-size: 60px;
|
||||
letter-spacing: 5px;
|
||||
/* 渐变背景 */
|
||||
background: linear-gradient(to right,#000,#fff,#000);
|
||||
/* 裁剪掉文字以外的区域 */
|
||||
-webkit-background-clip: text;
|
||||
background-size: 80%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
/* 执行动画:动画名 时长 线性 无线播放 */
|
||||
animation: move 2s linear infinite;
|
||||
}
|
||||
|
||||
/* 定义动画 */
|
||||
@keyframes move {
|
||||
0%{
|
||||
background-position: -500%;
|
||||
}
|
||||
100%{
|
||||
background-position: 500%;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
|
||||
|
||||
<title>纯CSS实现文本背景扫光效果</title>
|
||||
<link rel="stylesheet" href="112.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hello World, Hello Everybody!</h1>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue