试图在css中重新创建加载gif

Fin*_*nnn 5 html css css3 css-animations

我试图在纯css中重新创建以下gif -

加载图片

Css在这里 - http://codepen.io/anon/pen/FmCaL - (只在mo的webkit/chrome)

我试图通过使用前后psuedo选择器重新创建丢失的圆圈块,但我无法正确地获得角度.

它甚至可以吗?有更好的方法吗?


感谢您的帮助到目前为止.我应该指明我需要箭头是透明的.我不能使用纯色作为圆圈的缺失部分.

Mr.*_*ien 7

简单地这样做怎么样?

演示

div {
    border: 10px solid #000;
    height: 50px;
    width: 50px;
    border-radius: 50%;
    position: relative;    
}

div:after {
    height: 0;
    width: 0;
    display: block;
    position: absolute;
    right: -12px; 
    content: " ";
    border-bottom: 12px solid #fff;
    border-right: 12px solid transparent;
    transform: rotate(10deg);
}
Run Code Online (Sandbox Code Playgroud)

说明:我们在这里做的是使用:after伪将元素绝对定位到圆并使用transform属性来旋转三角形.


演示2(带动画)

div {
    border: 10px solid #000;
    height: 50px;
    width: 50px;
    border-radius: 50%;
    position: relative;    
    animation: spin 1s infinite linear;
}

div:after {
    height: 0;
    width: 0;
    display: block;
    position: absolute;
    right: -12px; 
    content: " ";
    border-bottom: 12px solid #fff;
    border-right: 12px solid transparent;
    transform: rotate(10deg);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
Run Code Online (Sandbox Code Playgroud)

我的建议:当你更新你的qustion,你说你想要一个透明的排水沟,我建议你使用一个.png图像并旋转它,而不是写100行CSS并担心跨浏览器的兼容性.或者,当我在评论中共享链接时,您可以使用CSS屏蔽.

  • @arbitter OP不想旋转,他想在戒指上制作一个三角形排水沟,这就是我所做的,所以这是一个答案,但后来他更新了这个问题.:) (4认同)
  • @Finnnn看看这个http://www.html5rocks.com/en/tutorials/masking/adobe/ (2认同)