JSFiddle - React, Tailwind, and code Playground
by phloe
HTML
<div class="container">
<div class="track">
<div class="item item--image">
<div class="image">
</div>
</div>
<div class="item">
</div>
<div class="item">
</div>
</div>
</div>
CSS
.container {
perspective: 200px;
transform-style: preserve-3d;
}
.track {
overflow-x: scroll;
white-space: nowrap;
font-size: 0;
}
.item {
display: inline-block;
font-size: 1rem;
width: 45%;
min-height: 300px;
position: relative;
margin: 20px;
background-color: green;
}
.item--image {
background-color: transparent;
}
.image {
margin: -60px;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: red;
transform: translateZ(-100px) scale(2);
}