Gewusst wie: Navigationslinks für den unteren Rand
Erfahren Sie, wie Sie mit CSS Navigationslinks mit unterem Rand (unterstrichen) erstellen.
Navigationslinks für den unteren Rand
Erstellen Sie ein Navigationsmenü
Schritt 1) HTML hinzufügen:
Beispiel
<div class="topnav">
<a href="#home"
class="active">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
</div>
Schritt 2) CSS hinzufügen:
Beispiel
/*
Add a black background color to the top navigation */
.topnav {
background-color: #333;
overflow: hidden;
}
/*
Style the links inside the navigation bar */
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
border-bottom: 3px solid transparent;
}
.topnav a:hover {
border-bottom: 3px solid red;
}
.topnav
a.active {
border-bottom: 3px solid red;
}
Tipp: Um für Mobilgeräte optimierte, responsive Navigationsleisten zu erstellen, lesen Sie unser How To – Responsive Top Navigation Tutorial.
Tipp: Gehen Sie zu unserem CSS Navbar Tutorial , um mehr über Navigationsleisten zu erfahren.