Here's an option with CSS only. This answer only contains some elements and styles that can help you. You need to see how best to adapt your content within collapses
so they do not extrapolate the boundaries of the container
I used a CSS rule that uses a hidden chackbox
tect, which when checked by clicking on the arrow that is actually a label
you change the height of div
. The effect of it increasing and collecting and done with transition
As I said, it's just an example that sometimes you can enjoy the idea.
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.pai {
display: flex;
flex-wrap: wrap;
}
.pai .filhos {
width: 100%;
position: relative;
height: 50px;
transition: all 500ms ease;
}
.pai .filhos label {
position: absolute;
width: 50px;
height: 50px;
bottom: -25px;
left: 50%;
transform: translateX(-50%);
border-radius: 50%;
z-index: 1;
cursor: pointer;
}
.pai .filhos label::before {
content: "";
position: absolute;
width: 0px;
height: 0px;
border: 15px solid transparent;
border-bottom-width: 15px;
border-bottom-color: #fff;
border-bottom-style: solid;
bottom: 0px;
left: 50%;
transform: translateX(-50%) scaleY(-1);
z-index: 2;
transition: all 300ms;
}
#id1:checked + div > label::before, #id2:checked + div > label::before, #id3:checked + div > label::before {
bottom: 15px;
transform: translateX(-50%) scaleY(1);
}
/* aqui vc controla a altura que a div vai ter quando aberta */
#id1:checked + div, #id2:checked + div, #id3:checked + div {
height: 100px;
}
.filho1, .filho1 label {
background-color: #f00;
z-index: 3;
}
.filho2, .filho2 label {
background-color: #0f0;
z-index: 2;
}
.filho3, .filho3 label {
background-color: #00f;
z-index: 1;
}
.pai > input[type="checkbox"] {
display: none;
}
<div class="pai">
<input type="checkbox" checked name="" id="id1">
<div class="filhos filho1">
123
<label for="id1"></label>
</div>
<input type="checkbox" checked name="" id="id2">
<div class="filhos filho2">
456
<label for="id2"></label>
</div>
<input type="checkbox" checked name="" id="id3">
<div class="filhos filho3">
789
<label for="id3"></label>
</div>
</div>