<div class="triangle">
<div class="top">Top</div>
<div class="mid">Middle</div>
<div class="bottom">Bottom</div>
</div>
body {
justify-content: center;
background-image: linear-gradient(black, white);
height: 100vh;
display: flex;
flex-direction: column;
}
.triangle {
position: relative;
height: 320px;
clip-path: polygon(50% 0%, 20% 100%, 80% 100%);
}
.triangle div {
position: absolute;
top: 0;
background: red;
width: 100%;
height: 100px;
margin: 0 auto;
color: white;
line-height: 100px;
text-align: center;
font-size: 0.8em;
color: red;
transition: all ease 0.6s;
}
.triangle:hover div {
color: white;
}
.top {
z-index: 2;
}
.mid {
z-index: 1;
}
.triangle:hover .mid {
top: 110px;
background: yellow;
}
.triangle:hover .bottom {
top: 220px;
background: blue;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.