更新第42个小实例

This commit is contained in:
DESKTOP-BM6RJU5\wyanh 2021-11-14 16:45:59 +08:00
parent 7ee2e5435d
commit d2c522e73f
3 changed files with 54 additions and 1 deletions

View File

@ -45,4 +45,5 @@
38. HTML5+CSS3小实例之3D分层按钮的悬停效果
39. HTML5+CSS3小实例之手机充电特效
40. HTML5+CSS3小实例之抽屉式相册
41. HTML5+CSS3小实例之发光文字悬停特效
41. HTML5+CSS3小实例之发光文字悬停特效
42. HTML5+CSS3小实例之背景不停渐变效果

36
css/42.css Normal file
View File

@ -0,0 +1,36 @@
body{
/* 初始化 取消内外边距 */
margin: 0;
padding: 0;
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平垂直居中 */
display: flex;
justify-content: center;
align-items: center;
/* 渐变背景 */
background: linear-gradient(125deg,#2c3e50,#27ae60,#2980b9,#e74c3c,#8e44ad);
/* 指定背景图像的大小 */
background-size: 500%;
/* 执行动画:动画名 时长 线性的 无限次播放 */
animation: bgAnimation 15s linear infinite;
}
.text{
color: #fff;
font-size: 30px;
/* 字间距 */
letter-spacing: 15px;
}
/* 定义动画 */
@keyframes bgAnimation {
0%{
background-position: 0% 50%;
}
50%{
background-position: 100% 50%;
}
100%{
background-position: 0% 50%;
}
}

16
html/42.html Normal file
View File

@ -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>背景不停渐变效果</title>
<link rel="stylesheet" href="../css/42.css">
</head>
<body>
<div class="text">渐变背景动画</div>
</body>
</html>