我创建了一个纯 css 六边形,它可以在除某些 Android 浏览器之外的所有浏览器上正常呈现,例如:Galaxy Note。生成的内容创建的圆角三角形未正确呈现。
我创建了一个小提琴来显示我的代码。 http://jsfiddle.net/mistermelotte/r8X8c/
HTML
<span class="hexagon"></span>
CSS
.hexagon {
position: relative;
margin: 1em auto;
width: 80px;
height: 55px;
border-radius: 5px;
background: #a0d1e6;
display: block;
}
.hexagon:before {
position: absolute;
top: -19px;
left: 0;
width: 0;
height: 0;
border-right: 40px solid transparent;
border-bottom: 20px solid #a0d1e6;
border-left: 40px solid transparent;
border-radius: 5px;
content:"";
}
.hexagon:after {
position: absolute;
bottom: -19px;
left: 0;
width: 0;
height: 0;
border-top: 20px solid #a0d1e6;
border-right: 40px solid transparent;
border-left: 40px solid transparent;
border-radius: 5px;
content:"";
}
.lt-ie9 .hexagon:before {
top: -20px;
}
.lt-ie9 .hexagon:after {
bottom: -20px;
}
感谢所有帮助。