Here’s an option made only with CSS. This answer only contains some elements and styles that can help you. You need to see how best to adapt your content within the collapses
so that they do not exceed the limits of container
I used a CSS rule that uses a chackbox
hidden that when it is marked by clicking the arrow it is actually a label
you change the height of div
. The effect of it increasing and gathering and done with the transition
As I said it’s just an example that sometimes you can take advantage of 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>
you use javascript/jquery?
– Wees Smith
I don’t know how to use it. I’ve never used Tb. My code is purely in HTML, CSS and PHP
– Enrico Pre
Enrico put what you already have of code that makes it easy to give you an answer that will be useful for you. You want the person to be able to open all the texts if you want, or you want them to be able to open one at a time, like if you open one you have to close the other?
– hugocsl
Look if you want to use Jquery it is easy to do this, see this example on the site w3schools: https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_eff_slideup_slidedown
– Edjane
hugocsl - whatever, in vdd, you can leave all the items open. What I need is for the person to click on that triangle, do the effect of it by rotating, then the content expands. Then if it is no longer of interest to the user, he can close this tab. But he can leave all the open items, this is indifferent.
– Enrico Pre
Put the code because it will depend on the HTML structure to define selectors etc.
– Sam
Cara vc is using some Materialize or Bootstrap framework?
– hugocsl
I’m not using Framework, I use Visual Studio as editor
– Enrico Pre