Is it possible to create an effect where the previous block overlaps the next one using CSS?
.container {
padding: 70px;
width: 500px;
margin: auto;
display: flex;
}
.block {
margin-left: -30px;
width: 200px;
height: 100px;
border: 1px dotted green;
transform: skewY(20deg)
}
.red {
background-color: red;
}
.green {
background-color: green;
}
.blue {
background-color: blue;
}
.black {
background-color: black;
}
<div class="container">
<div class="block red">Text...</div>
<div class="block green">Text...</div>
<div class="block blue">Text...</div>
<div class="block black">Text...</div>
</div>
You could manually set z-index for each block with CSS, but imagine if there were a hundred blocks?
Codepen link: