CSS loader spinner to add white divider between the donut parts

css spinner loader

163 观看

2回复

1177 作者的声誉

I am trying to add some white dividers between blue and black. Please see the GIF animation below. Please edit my CSS in jsbin to mimic the same animation in the image. I only need CSS version of this animation without SVG or JS.

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

作者: Nizzy 的来源 发布者: 2017 年 9 月 15 日

回应 2


3

1308 作者的声誉

决定

Please check the updated code. I hope it works well for you.

.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>

作者: Anmol Sandal 发布者: 2017 年 9 月 15 日

1

1294 作者的声誉

Check this for your perfect requirement:

.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); }
}
<div class="loaderborder"><span></span></div>

You can also check this Fiddle

作者: kravisingh 发布者: 2017 年 9 月 15 日
32x32