Hoe - Verticaal menu
Leer hoe u een verticaal menu maakt met CSS.
Verticaal menu
Een verticale knopgroep maken
Stap 1) HTML toevoegen:
Voorbeeld
<div class="vertical-menu">
<a href="#"
class="active">Home</a>
<a href="#">Link
1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
<a href="#">Link 4</a>
</div>
Stap 2) CSS toevoegen:
Voorbeeld
.vertical-menu {
width: 200px; /* Set a width if you like */
}
.vertical-menu a {
background-color: #eee;
/* Grey background color */
color: black; /* Black text
color */
display: block; /* Make the links appear below
each other */
padding: 12px; /* Add some padding */
text-decoration: none; /* Remove underline from links */
}
.vertical-menu a:hover
{
background-color: #ccc; /*
Dark grey background on mouse-over */
}
.vertical-menu a.active {
background-color: #04AA6D; /* Add a green color to the "active/current" link
*/
color: white;
}
Verticaal scrollmenu
Stel een specifieke in height
en voeg de overflow
eigenschap toe als u een verticaal schuifmenu wilt:
Voorbeeld
.vertical-menu {
width: 200px;
height: 150px;
overflow-y: auto;
}
Tip: bekijk onze How To - Side Navigation- tutorial om te leren hoe u een vaste zijnavigatie op volledige hoogte maakt.