正如其他答案一样,使形状完美的最佳方法是使用 SVG。然而,使用 css3 以及前后伪元素的帮助,您可能会拥有接近的形状。
这个还远远不够好,因为我已经将FIDDLE作为一个快速示例,但随着时间的推移,您可能会得到更好的结果:
div {
position: relative;
width: 200px;
height: 150px;
margin: 20px 0;
background: green;
border-radius: 50% / 10%;
color: white;
text-align: center;
text-indent: .1em;
}
div:before {
content: '';
position: absolute;
top: 10%;
bottom: 10%;
right: -5%;
left: -5%;
background: inherit;
border-radius: 5% / 50%;
}
div:after {
content: '';
position: absolute;
bottom: 0px;
right: -11px;
width: 130px;
height: 120px;
background: green;
border-radius: 20% / 150%;
}
Run Code Online (Sandbox Code Playgroud)