I have a list of sections and some have a details element within. Now I need to change these sections order using flexbox, but when I use the order attribute, the details element expands upwards, and not to the bottom like usual.
All these sections are inside a flex display. Tried to change positions, display to grid, change the height of each section but nothing really works. I need to keep it expanding just to the bottom. Here an example, you can try expading the Test 5 and 7 details element:
.sections {
display: flex;
flex-direction: column;
gap: 2.2rem;
}
section:nth-child(3) {
order: 6;
}
section:nth-child(4) {
order: 3;
}
section:nth-child(5) {
order: 4;
}
section:nth-child(6) {
order: 7;
}
section:nth-child(7) {
order: 5;
}
section:nth-child(8) {
order: 10;
}
section:nth-child(9) {
order: 9;
}
section:nth-child(10) {
order: 8;
}
section:nth-child(11) {
order: 11;
}
<html>
<body>
<div class="sections">
<section>
<p>
Lorem Ipsum is simply dummy text of the printing and</br> typesetting industry. Lorem Ipsum has been the</br> industry's standard dummy text ever since the 1500s,
</br>when an unknown printer took a galley of type and scrambled it
</p>
</section>
<section>
<details>
<summary>Test 2</summary>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
</details>
</section>
<section>
<p>
Lorem Ipsum is simply dummy text of the printing and</br> typesetting industry. Lorem Ipsum has been the</br> industry's standard dummy text ever since the 1500s,
</br>when an unknown printer took a galley of type and scrambled it
</p>
</section>
<section>
<p>
Lorem Ipsum is simply dummy text of the printing and</br> typesetting industry. Lorem Ipsum has been the</br> industry's standard dummy text ever since the 1500s,
</br>when an unknown printer took a galley of type and scrambled it
</p>
</section>
<section>
<details>
<summary>Test 5</summary>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
</details>
</section>
<section>
<details>
<summary>Test 6</summary>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
</details>
</section>
<section>
<details>
<summary>Test 7</summary>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
</details>
</section>
<section>
<details>
<summary>Test 8</summary>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
</details>
</section>
<section>
<details>
<summary>Test 9</summary>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
</details>
</section>
<section>
<p>
Lorem Ipsum is simply dummy text of the printing and</br> typesetting industry. Lorem Ipsum has been the</br> industry's standard dummy text ever since the 1500s,
</br>when an unknown printer took a galley of type and scrambled it
</p>
</section>
<section>
<p>
Lorem Ipsum is simply dummy text of the printing and</br> typesetting industry. Lorem Ipsum has been the</br> industry's standard dummy text ever since the 1500s,
</br>when an unknown printer took a galley of type and scrambled it Lorem Ipsum is simply dummy text of the printing and</br> typesetting industry. Lorem Ipsum has been the</br> industry's standard dummy text ever since the 1500s,
</br>when an unknown printer took a galley of type and scrambled it
</p>
</section>
</div>
</body>
</html>
You can note that, depending on the scroll position, it expands to different directions.
Anyone knows why this happens? How can I keep it expanding just to the bottom?