body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
/* Фоновый квадрат */
.canvas {
width: 300px;
height: 300px;
background-color: #8dbfc2;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
/* Контейнер для слоев */
.stack {
position: relative;
width: 150px;
height: 150px;
}
/* Общие стили для каждого слоя */
.layer {
position: absolute;
width: 100%;
height: 100%;
/* Поворот и наклон для создания эффекта перспективы */
transform: rotate(-45deg) skew(15deg, 15deg);
transition: 0.3s;
}
/* Цвета и смещение по вертикали */
.white {
background-color: #ffffff;
top: -40px; /* Самый верхний */
z-index: 3;
}
.cyan {
background-color: #2499aa;
top: 0; /* Средний */
z-index: 2;
}
.dark-blue {
background-color: #004273;
top: 40px; /* Нижний */
z-index: 1;
}
<div class="canvas">
<div class="stack">
<div class="layer white"></div>
<div class="layer cyan"></div>
<div class="layer dark-blue"></div>
</div>
</div>