This eludes the start of the game, but it is different enough to guarantee its own answer.
Instead of placing the color block excessively, it adds only red elements, allowing the background to show. HOWEVER, to correctly calculate (so that they are square corners!), I had to set a fixed height width . Probably some kind of wacky way to do this with interest, but to prove the concept it was too scary to behold. Since the requirement is for a fixed height of variable width, this should work.
Pseudo-elements must have content or they are โcrumblingโ. The content may be empty, but this property must be set.
CSS
.button { display:inline-block; background: #f00; position: relative; line-height: 60px; text-align: center; padding: 0 20px; height: 60px; margin-left: 0.5em; } .button, .button::before, .button::after { background-color: #f00; } .button::before, .button::after { content: ""; position: absolute; height: 50px; width: 5px; top: 5px; } .button::before { left: -5px; } .button::after { right: -5px; }
Fiddle: http://jsfiddle.net/3R9c5/2/
Greg pettit
source share