首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何用CSS3制作弧形?

如何用CSS3制作弧形?
EN

Stack Overflow用户
提问于 2013-05-10 04:20:53
回答 1查看 23.6K关注 0票数 17

我试着用纯css实现下面的外观:

其中每个白色圆弧是一个不同的元素,比如span。我知道我们可以用css做圆形,但它怎么才能变成弧形呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-10 04:25:37

包含以下HTML:

代码语言:javascript
复制
<div id="arcs">
    <div>
        <div>
            <div>
                <div></div>
            </div>
        </div>
    </div>
</div>

和CSS:

代码语言:javascript
复制
#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;
}

代码语言:javascript
复制
#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;
}
代码语言:javascript
复制
<div id="arcs">
  <div>
    <div>
      <div>
        <div></div>
      </div>
    </div>
  </div>
</div>

JS Fiddle demo

票数 63
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16470412

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档