不需要JavaScript,也不需要图片,只用纯CSS就能实现多种炫酷的Loading特效!我这次创作的两个圆形Loading特效,大小不断变换,就像是在呼吸一样,让人忍不住一直盯着它看。如果你也想要让你的网站更加吸引人,不妨试试用纯CSS来实现自己的Loading特效吧!
<div class="loading"></div>
<style>
.loading {
margin: 20px;
position: relative;
width: 1px;
height: 1px;
}
.loading:before,
.loading:after {
position: absolute;
display: inline-block;
width: 15px;
height: 15px;
content: "";
border-radius: 100%;
background-color: #000;
}
.loading:before {
left: -15px;
animation: ball-pulse infinite 0.75s -0.4s cubic-bezier(0.2, 0.68, 0.18, 1.08);
}
.loading:after {
right: -15px;
animation: ball-pulse infinite 0.75s cubic-bezier(0.2, 0.68, 0.18, 1.08);
}
@keyframes ball-pulse {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(0.1);
opacity: 0.6;
}
100% {
transform: scale(1);
opacity: 1;
}
}
</style>