Use the CSS Transform Property skewX to Skew an Element Along the X-Axis
Summary
- The
skewX()
function of thetransform
property is used to skew an element along the x-axis by a given degree.
Final Code
<style>
div {
width: 70%;
height: 100px;
margin: 50px auto;
}
#top {
background-color: red;
}
#bottom {
background-color: blue;
transform: skewX(24deg);
}
</style>
<div id="top"></div>
<div id="bottom"></div>