我想创建一个这样的盾牌:
http://www.red-team-design.com/wp-content/uploads/2011/01/HTML5-logo.png
这是我迄今为止尝试过的,但我无法将底部区域设为箭头形状,也无法增加顶部区域的高度。
我怎样才能做到这一点?
http://codepen.io/helloworld/pen/IxEpy
<div id="octagon">
<div>content</div>
</div>
#octagon {
width: 100px;
height: 100px;
background: blue;
}
#octagon:before {
height: 100;
width: 40px;
content:"";
position: absolute;
border-bottom: 0px solid blue;
border-left: 30px solid white;
border-right: 30px solid white;
}
#octagon:after {
height: 0;
width: 40px;
content:"";
position: absolute;
border-top: 100px solid blue;
border-left: 30px solid white;
border-right: 30px solid white;
margin: 50px 0 0 0;
}