CSS loader spinner在甜甜圈部分之间添加白色分隔符

时间:2017-09-15 05:02:59

标签: css spinner loader

我想在蓝色和黑色之间添加一些白色分隔线。请参阅下面的GIF动画。请在jsbin中编辑我的CSS以模仿图像中的相同动画。我只需要没有SVG或JS的动画的CSS版本。

spinner loading

.spinner {
   height:60px;
   width:60px;
   animation: rotation 10s infinite linear;
   border-left:7px solid rgba(0,0,0,1);
   border-right:7px solid rgba(0,0,0,1);
   border-bottom:7px solid rgba(0,174,239,1);
   border-top:7px solid rgba(0,174,239,1);
   border-radius: 100%;
}

@keyframes rotation {
   from {transform: rotate(0deg);}
   to {transform: rotate(359deg);}
}

http://jsbin.com/ziniwexuwi/edit?html,css,output

2 个答案:

答案 0 :(得分:3)

请检查更新的代码。我希望它适合你。



.spinner {
   height:62px;
   width:62px;
   border-left:7px solid rgba(0,0,0,1);
   border-right:7px solid rgba(0,0,0,1);
   border-bottom:7px solid rgba(0,174,239,1);
   border-top:7px solid rgba(0,174,239,1);
   border-radius: 100%;
   border-spacing: 1px;
   position: relative;
   animation: rotation 1s infinite linear;
}

.spinner span {
  height: 7px;
  width: 2px;
  background: #fff;
  position: absolute;
  z-index: 1;
}

.spinner .a {
  left: 6px;
  top:3px;
  transform: rotate(-47deg);
}

.spinner .b {
  right: 6px;
  top:3px;
  transform: rotate(47deg);
}

.spinner .c {
  left: 6px;
  bottom: 3px;
  transform: rotate(47deg);
}

.spinner .d {
  right: 6px;
  bottom: 3px;
  transform: rotate(-47deg);
}

@keyframes rotation {
   from {transform: rotate(0deg);}
   to {transform: rotate(359deg);}
}

<div class="spinner">
<span class="a"></span>
<span class="b"></span>
<span class="c"></span>
<span class="d"></span>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

检查一下您的完美要求:

&#13;
&#13;
.loaderborder {
  position: relative;
  display: inline-block;
  border: 16px solid #87ceeb;
  border-radius: 50%;
  border-top: 16px solid #000;
  border-right: 16px solid #87ceeb;
  border-bottom: 16px solid #000;
  width: 100px;
  height: 100px;
  -webkit-animation: loaderborder 2.5s linear infinite;
  animation: loaderborder 2.5s linear infinite;
}
.loaderborder:before{
  content: '';
    border-left: 16px solid #fff;    
    width: 0;
    height: 9px;
    border-radius: 0%;
    display: inline-block;
    transform: rotate(50deg);
}
.loaderborder:after{
  content: '';
    border-right: 16px solid #fff;
    width: 0;
    height: 9px;
    border-radius: 0;
    display: inline-block;
    transform: rotate(-52deg);
    position: absolute;
    right: 0;
    top: 5px;
}
.loaderborder span{
  display: inline-block;
}
.loaderborder span:before{
  content: '';
    border-top: 16px solid #fff;
    width: 10px;
    height: 9px;
    border-radius: 0%;
    display: inline-block;
    transform: rotate(50deg);
    position: absolute;
    z-index: 999;
    top: 78px;
    left: -2px;
}
.loaderborder span:after{
  content: '';
    border-bottom: 16px solid #fff;
    width: 9px;
    height: 9px;
    border-radius: 0;
    display: inline-block;
    transform: rotate(-52deg);
    position: absolute;
    z-index: 9999;
    top: 73px;
    left: 85px;
}
@-webkit-keyframes loaderborder {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes loaderborder {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
&#13;
<div class="loaderborder"><span></span></div>
&#13;
&#13;
&#13;

您还可以查看此Fiddle