How TO - Pille-Navigation
Erfahren Sie, wie Sie mit CSS ein Pillen-Navigationsmenü erstellen.
Pille-Navigation
Erstellen Sie eine Pillennavigation
Schritt 1) HTML hinzufügen:
Beispiel
<div class="pill-nav">
<a class="active" href="#home">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<a href="#about">About</a>
</div>
Schritt 2) CSS hinzufügen:
Beispiel
/* Style the links inside the pill navigation menu */
.pill-nav a {
display: inline-block;
color: black;
text-align: center;
padding: 14px;
text-decoration: none;
font-size: 17px;
border-radius: 5px;
}
/* Change the color of links on mouse-over */
.pill-nav a:hover {
background-color: #ddd;
color: black;
}
/* Add a color to the active/current link */
.pill-nav a.active {
background-color: dodgerblue;
color:
white;
}
Vertikale Pillen-Navigation
Fügen Sie display: block
den Links hinzu, und sie werden vertikal statt horizontal angezeigt:
Beispiel
Tipp: Siehe auch So erstellen Sie ein oberes Navigationsmenü .
Tipp: Gehen Sie zu unserem CSS Navbar Tutorial , um mehr über Navigationsleisten zu erfahren.