JSFiddle - React, Tailwind, and code Playground
by Hugo Vale Pereira
HTML
<div class="container">
<div class="element"></div>
<div class="element2"></div>
</div>
CSS
html {
height: 100vh;
overflow: auto;
padding: 10vh 0;
perspective: 8px;
perspective-origin: 50%;
}
.container {
display: flex;
justify-content: center;
align-items: center;
border: 1px solid black;
height: 200px;
width: 200px;
padding: 100px 0;
box-sizing: border-box;
overflow: auto;
}
.element {
transform: translateZ(0px);
height: 100px;
width: 100px;
background: red;
}
.element2 {
transform: translateZ(-1px);
height: 100px;
width: 100px;
background: blue;
}