What you are locking for is the property transform: skew()
.
Just give the container its value and its child elements the opposite one.
.skew {
background: #ff00ff;
text-align: center;
padding: 1rem;
width: 60%;
transform: skew(-20deg);
margin: 0 auto;
}
h1 {
transform: skew(20deg);
}
<div class="skew">
<h1>Hello World!</h1>
</div>