JSFiddle - React, Tailwind, and code Playground
by Vadim Shaikhislamov
HTML
<div class="container">
<div class="first"></div>
<div class="second"></div>
<div class="third"></div>
<div class="fourth"></div>
</div>
CSS
.container {
width: 400px;
}
.first, .second, .third, .fourth {
position: relative;
height: 100px;
width: 100px;
float: left;
background-color: red;
}
.first {
height: 200px;
width: 400px;
}
.second {
background-color: yellow;
}
.third {
height: 100px;
width: 300px;
background-color: yellow;
}
.fourth {
width: 400px;
}
.second:before {
content: "";
width: 0;
height: 0;
border-bottom: 75px solid red;
border-right: 100px solid transparent;
position: absolute;
bottom: 0px;
}
.second:after {
content: "";
width: 0;
height: 0;
border-top: 75px solid red;
border-left: 100px solid transparent;
position: absolute;
top: 0px;
}
.third:before {
content: "";
width: 0;
height: 0;
border-bottom: 75px solid red;
border-left: 300px solid transparent;
position: absolute;
bottom: 0px;
}
.third:after {
content: "";
width: 0;
height: 0;
border-top: 75px solid red;
border-right: 300px solid transparent;
position: absolute;
top: 0px;
}