HTML主体结构
<body>
<div class="spinner">
<i></i>
</div>
</body>
CSS样式
.spinner{
margin: 100px auto;
border-radius: 50%;
font-size: 50px;
width: 1em;
height: 1em;
border-radius: 50%;
box-shadow: inset 0 0 0 .1em rgba(58, 168, 237, .2);
}
.spinner i{
position: absolute;
clip:rect(0,1em,1em,.5em);
width: 1em;
height: 1em;
animation: spinner-circle-clipper 1s ease-in-out infinite;
}
.spinner i:after{
position: absolute;
clip: rect(0, 1em, 1em, .5em);
width: 1em;
height: 1em;
content: '';
animation: spinner-circle 1s ease-in-out infinite;
border-radius: 50%;
box-shadow: inset 0 0 0 .1em #3aa8ed;
}
@keyframes spinner-circle-clipper{
0% {
transform: rotate(0deg);
}
100%{
transform: rotate(180deg);
}
}
@keyframes spinner-circle{
0% {
transform: rotate(-180deg);
}
100%{
transform: rotate(180deg);
}
}
效果图