【发布时间】:2014-01-05 00:48:46
【问题描述】:
如何在 CSS3 中制作以下形状,而不使用像 ":before" 这样的伪类?
我用 :before 很容易做到,但问题是我不想在灰色区域有一个实心元素(请参阅 JSFiddle - http://jsfiddle.net/aUdLr/2/)
div{
width: 100px;
height: 100px;
background-color: red;
border-radius: 100%;
position: relative;
}
div:before{
content: "";
width: 100%;
height: 110%;
background: gray;
position: absolute;
left: 5px;
top: -5%;
border-radius: 100%;
}
【问题讨论】:
-
This website 可能会对您有所帮助。不过,您的形状没有示例。
标签: html css shape css-shapes pseudo-class