css - 带有切割顶部和底部的特殊 CSS3 圆

标签 css geometry

我想知道是否可以在 CSS3 中创建一个圆,然后在顶部和底部切掉一点?

像这样: enter image description here

如果有人能帮我解决这个问题就太好了:D

  • TheYaXxE

最佳答案

好的,找到方法了。您需要做的是创建一个容器 div,然后在其中放置圆圈。使容器小于圆,并 overflow hidden 。这是一个 JS fiddle :

http://jsfiddle.net/CrD3q/1/

CSS:

.circle {
    position: relative;
    top: -6px;
    width: 108px;
    height: 108px;
    background: blue;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
}

.container{
    height: 96px;
    width: 108px;
    overflow:hidden;
}

HTML:

<div class="container">
    <div class="circle"></div>
</div>

这应该让你开始了,现在根据你的需要摆弄它!

关于css - 带有切割顶部和底部的特殊 CSS3 圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17476649/

相关文章:

math - 围绕一个点旋转 Vector2

javascript - 带有粘性页眉、页脚、列和可滚动主体(X 和 Y)的 HTML 表格

css - 如何制作 PriceGrabber.com 底部的栏

HTML/CSS - [shopify (brooklyn theme)] 我可以在 HTML 中更改尺寸/颜色,但想在 CSS 中进行

html - 如何在绝对定位的 float 元素周围定义边距(CSS)?

c# - 寻找一组点的具体轮廓

c# - 判断三角形是否正对

javascript - 追加 div 最多 5 次并忽略超过 5 次 - jQuery

c++ - opencv2.1.0中的R树

algorithm - 列出四面体的所有有趣部分