The reason the div looks like it is currently happening is because you actually do not have an eight-pointed star, you have 2 squares superimposed on each other.
The first step is to add an outline to: in front of the pseudo-class. The second is to add: after a pseudo-class without an outline rotated to the same position as the original div to cover the outline drawn: before the original div overlaps.
Demo: https://jsfiddle.net/hj1eh6md/
and CSS:
#star8 { border: 3px solid red; background: olive; width: 80px; height: 80px; position: relative; -webkit-transform: rotate(20deg); -moz-transform: rotate(20deg); -ms-transform: rotate(20deg); -o-transform: rotate(20eg); } #star8:before { border: 3px solid red; content: ""; position: absolute; top: 0; left: 0; height: 80px; width: 80px; background: olive; -webkit-transform: rotate(135deg); -moz-transform: rotate(135deg); -ms-transform: rotate(135deg); -o-transform: rotate(135deg); } #star8:after{ content: ""; position: absolute; top: 0; left: 0; height: 80px; width: 80px; background: olive; }
James proctor
source share