JSFiddle - React, Tailwind, and code Playground
HTML
<div class="slanted">
<h2>Hello World!</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis et debitis pariatur perferendis adipisci doloribus aspernatur ea quo illum a.</p>
</div>
CSS
body {
margin-top: 10vh;
}
.slanted {
background: red;
box-sizing: border-box;
height: 40vh;
width: 100%;
position: relative;
padding: 20px;
}
.slanted:before {
content: "";
background: yellow;
height: 100%;
width:50px;
transform: skewX(-190deg);
position: absolute;
right: 0;
top:20px;
z-index: 1;
}
.slanted:after {
content: "";
background: red;
height: 40px;
transform: skewY(1deg);
position: absolute;
left: 0;
right: 0;
z-index: -1;
}
.slanted:before{
top: -20px;
}
.slanted:after {
bottom: -30px;
}