我试图实现以下的外观,用纯CSS:
其中每个白色弧是不同的元素,说跨度。我知道我们可以用css做圆形,但是怎么能变成弧形呢?
解决方法
使用以下HTML:
<div id="arcs"> <div> <div> <div> <div></div> </div> </div> </div> </div>
和CSS:
#arcs div { border: 2px solid #000; /* the 'strokes' of the arc */ display: inline-block; min-width: 4em; /* the width of the innermost element */ min-height: 4em; /* the height of the innermost element */ padding: 0.5em; /* the spacing between each arc */ border-radius: 50%; /* for making the elements 'round' */ border-top-color: transparent; /* hiding the top border */ border-bottom-color: transparent; }
#arcs div { border: 2px solid #000; /* the 'strokes' of the arc */ display: inline-block; min-width: 4em; /* the width of the innermost element */ min-height: 4em; /* the height of the innermost element */ padding: 0.5em; /* the spacing between each arc */ border-radius: 50%; /* for making the elements 'round' */ border-top-color: transparent; /* hiding the top border */ border-bottom-color: transparent; }
<div id="arcs"> <div> <div> <div> <div></div> </div> </div> </div> </div>