i need to align the list elements under the menu items, but the layout crashes when the fourth item is displayed. I can't change the HTML code without affecting the layout of my app. Is there a way to dynamically hide and show the elements on the page while maintaining the right spacing between them? Flexbox might be a solution. Thank you!
Here is the CSS code:
#navigation {
width:100%;
}
/*Menu Items (Containers, Bulky Waste, Assessments, Service)*/
#navigation h3 {
font-size: 1.3rem;
float:left;
height: 22%;
width: 14%;
margin-left: 10%;
background-color: #edf3d0;
border-top-right-radius: 15px;
border-bottom-left-radius: 15px;
border-left: solid 8px transparent;
border-right: solid 8px transparent;
margin-top: 3rem;
}
#navigation > h3:nth-child(1) {
margin-top: 3rem;
}
#navigation h3 {
border-left: solid 8px #a4c412;
border-right: solid 8px #a4c412;
}
/*** List under Containers Menu Item ****/
#navigation > div.dropdown.behaelter_content {
left: 10%;
}
/*** List under Bulky Waste Menu Item ****/
#navigation > div.dropdown.sperrmuell_content {
left: 35%
}
/*** List under My Area Menu Item ****/
#navigation > div.dropdown.mein_bereich_content {
left:60%;
}
/**** Hidden: Assessments ***/
#navigation > div.dropdown.veranlagungen_content {
left:85%
}
.dropdown {
width: 15% !important;
position:fixed;
top: 60%;
float: left;
}
<div id="navigation" class="center">
<h3 id="behaelter" class="behaelter_content ">
...
</h3>
<div class="dropdown behaelter_content ">
...
</div>
<h3 id="sperrmuell" class="sperrmuell_content">
...
</h3>
<div class="dropdown sperrmuell_content">
...
</div>
<h3 id="veranlagungen" class="veranlagungen_content">
...
</h3>
<div class="dropdown veranlagungen_content">
...
</div>
<h3 id="mein_bereich" class="mein_bereich_content">
...
</h3>
<div class="dropdown mein_bereich_content">
...
</div>
</div>