【发布时间】:2014-09-09 06:42:45
【问题描述】:
这是我的 CSS。
CSS
#hexagon-circle {
width: 100px;
height: 55px;
background: red;
position: relative;
border-radius: 10px;}
#hexagon-circle:before {
content: "";
position: absolute;
top: -25px;
left: 0;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 29px solid red;
border-radius: 10px;}
#hexagon-circle:after {
content: "";
position: absolute;
bottom: -25px;
left: 0;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 29px solid red;
border-radius: 10px;}
输出是六边形的 4 个边是弯曲的,但顶部和底部不是。我想让六边形的所有边缘弯曲。如何使顶部和底部边缘弯曲?或者如何使三角形的上边缘弯曲?
【问题讨论】:
-
请也发布相关的html,或发Fiddle。
-
jsfiddle.net/yR7zt 谢谢@Ullas
-
您用来制作六边形的方法不允许您制作弯曲的顶部和底部。您可以为您的项目使用 Css 转换属性吗?
标签: html css css-shapes