You can do this with a single element and a pseudo-element :after . Just create a smaller pseudo-element that has border-top and border-right , and then rotate it for 45deg .
.element { width: 50px; height: 60px; background: yellow; position: relative; } .element:after { content: ''; position: absolute; top: 15px; border-top: 1px solid black; border-right: 1px solid black; height: 30px; width: 30px; transform: rotate(45deg); }
<div class="element"></div>
To create another button, simply rotate it for -135deg and set right: 0px
.element { width: 50px; height: 60px; background: yellow; position: relative; display: inline-block; margin: 50px; } .element:after { content: ''; position: absolute; top: 15px; border-top: 1px solid black; border-right: 1px solid black; height: 30px; width: 30px; transform: rotate(45deg); } .element.right:after { transform: rotate(-135deg); right: 0px; }
<div class="element"></div> <div class="element right"></div>
source share