小编Ark*_*uen的帖子

六角形,边框/轮廓

我知道可以使用以下代码创建六边形:

.hex:before {
    content: " ";
    width: 0; height: 0;
    border-bottom: 30px solid #6C6;
    border-left: 52px solid transparent;
    border-right: 52px solid transparent;
    position: absolute;
    top: -30px;
}

.hex {
    margin-top: 30px;
    width: 104px;
    height: 60px;
    background-color: #6C6;
    position: relative;
}

.hex:after {
    content: "";
    width: 0;
    position: absolute;
    bottom: -30px;
    border-top: 30px solid #6C6;
    border-left: 52px solid transparent;
    border-right: 52px solid transparent;
}
Run Code Online (Sandbox Code Playgroud)

如何创建一个填充了一种颜色并用另一种颜色勾勒出来的六边形?我试图摆弄它,但似乎不可能.

欢迎任何其他选择,我想避免使用图像.

html css css3 css-shapes

17
推荐指数
2
解决办法
3万
查看次数

标签 统计

css ×1

css-shapes ×1

css3 ×1

html ×1