在网页加载相关内容的时候为用户加上一个合适的加载过程动画或者文字提示,可以转移用户注意,提高用户体验。统计显示随着网页更新时间越长,用户流失越多。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body{
margin: 0;
padding: 0;
background: #b929b5;
}
.loading{
position: absolute;
top:50%;
left: 50%;
transform: translate(-50%,-50%);
height: 40px;
display: flex;
align-items: center;
}
.item{
6px;
height: 40px;
background: #fff;
margin: 0 3px;
border-radius: 10px;
animation: loading 0.8s infinite;
}
.item:nth-child(2){
animation-delay: 0.1s;
}
.item:nth-child(3){
animation-delay: 0.2s;
}
.item:nth-child(4){
animation-delay: 0.3s;
}
.item:nth-child(5){
animation-delay: 0.4s;
}
.item:nth-child(6){
animation-delay: 0.5s;
}
.item:nth-child(7){
animation-delay: 0.6s;
}
.item:nth-child(8){
animation-delay: 0.7s;
}
@keyframes loading{
0%{
height: 0;
}
50%{
height: 40px;
}
100%{
0
}
}
</style>
</head>
<body>
<div class="loading">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</body>
</html>