JSFiddle - React, Tailwind, and code Playground
HTML
<div id="trapezoid">
Trapezoid created with perspective and rotate3d
</div>
CSS
#trapezoid {
width : 200px;
height : 50px;
margin : 10px;
padding : 10px;
position : relative;
text-align : center;
}
#trapezoid::before {
-webkit-transform : perspective(400px) rotate3d(1, 0, 0, 20deg);
-moz-transform : perspective(400px) rotate3d(1, 0, 0, 20deg);
-o-transform : perspective(400px) rotate3d(1, 0, 0, 20deg);
-ms-transform : perspective(400px) rotate3d(1, 0, 0, 20deg);
transform : perspective(400px) rotate3d(1, 0, 0, 20deg);
outline : 1px solid transparent;
border-radius : 5px 5px 0 0;
position : absolute;
top : 0;
bottom : 0;
left : 0;
right : 0;
content : '';
z-index : -1;
background : red;
}