http://www.css3shapes.com/でこのコード スニペットを見つけましたが、その背後にあるロジックを理解できません。つまり、前後のセレクターの機能を知っています。私が混乱している{ height:0; width:40px; }
のは、コードにある理由です。誰かがこのコードについて完全な説明をすることができれば、それは大歓迎です。
#octagon {
width: 100px;
height: 100px;
background: blue;
}
#octagon:before {
height: 0;
width: 40px;
content:"";
position: absolute;
border-bottom: 30px solid blue;
border-left: 30px solid white;
border-right: 30px solid white;
}
#octagon:after {
height: 0;
width: 40px;
content:"";
position: absolute;
border-top: 30px solid blue;
border-left: 30px solid white;
border-right: 30px solid white;
margin: 70px 0 0 0;
}