css
*{
margin: 0;
padding: 0;
}
#load{
width: 100%;
height: 100%;
display: block;
position: absolute;
z-index:1999 !important;
background-color: rgba(0,0,0,0.5);
}
#loadmain {
width: 400px;
height: 50px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
align-items: center;
}
#loadmain>div:nth-child(2) {
width: 150px;
height: 20px;
margin-left: 5px;
font-size: 18px;
font-weight: 800;
color: #fff;
font-family:'Times New Roman','sans-serif', 宋体, 楷体;
}
.loading {
width: 60px;
height: 20px;
}
.loading span {
display: inline-block;
width: 8px;
height: 100%;
border-radius: 4px;
background: #ccc;
-webkit-animation: load 1s ease infinite;
}
dot {
display: inline-block;
height: 1em;
line-height: 1;
text-align: left;
vertical-align: -.25em;
overflow: hidden;
}
dot::before {
display: block;
content: '...\A..\A.';
white-space: pre-wrap;
animation: dot 2s infinite step-start both;
}
@keyframes dot {
33% {
transform: translateY(-2em);
}
66% {
transform: translateY(-1em);
}
}
@-webkit-keyframes load {
0%,
100% {
height: 20px;
background: #ccc;
}
50% {
height: 50px;
margin: -15px 0;
background: lightblue;
}
}
.loading span:nth-child(2) {
-webkit-animation-delay: 0.3s;
}
.loading span:nth-child(3) {
-webkit-animation-delay: 0.5s;
}
.loading span:nth-child(4) {
-webkit-animation-delay: 0.7s;
}
.loading span:nth-child(5) {
-webkit-animation-delay: 0.9s;
}
html
<div id="load">
<div id="loadmain">
<div class="loading">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div>正在加载中...</div>
</div>
</div>
最终效果