我可以通过以下方法实现带有实心边框的六边形:
.hex {
margin-top: 70px;
width: 208px;
height: 120px;
background: red;
position: relative;
}
.hex:before,
.hex:after {
content: "";
border-left: 104px solid transparent;
border-right: 104px solid transparent;
position: absolute;
}
.hex:before {
top: -59px;
border-bottom: 60px solid red;
}
.hex:after {
bottom: -59px;
border-top: 60px solid red;
}
.hex.inner {
background-color: lightgreen;
-webkit-transform: scale(.98, .98);
-moz-transform: scale(.98, .98);
transform: scale(.98, .98);
z-index: 1;
}
.hex.inner:before {
border-bottom: 60px solid lightgreen;
}
.hex.inner:after {
border-top: 60px solid lightgreen;
}
<div class="hex">
<div class="hex inner">
</div>
</div>