Wie man erstellt: Seitennavigationsschaltfläche
- Previous page Canvas outside menu
- Next page Sidebar with icons
Lerne, wie man mit CSS eine kollaborative Seitennavigation-Schaltfläche erstellt.
Wie man eine kollaborative Seitennavigation erstellt
Schritt 1 - Füge HTML hinzu:
<div id="mySidenav" class="sidenav"> <a href="#" id="about">Über uns</a> <a href="#" id="blog">Blog</a> <a href="#" id="projects">Projekte</a> <a href="#" id="contact">Kontakt</a> </div>
Schritt 2 - Füge CSS hinzu:
/* Setzt die Styles für die Links im Seiten-Navigation */ #mySidenav a { position: absolute; /* Positioniert sie relativ zum Browserfenster */ left: -80px; /* Legt sie ausserhalb des Bildschirms positioniert */ transition: 0.3s; /* Fügt eine Übergangseffekt beim鼠标悬停 hinzu */ padding: 15px; /* 15px Innenabstand */ width: 100px; /* Setzt die spezifische Breite */ text-decoration: none; /* Entfernt den Unterstrich */ font-size: 20px; /* Erhöht die Zeichengröße */ color: white; /* Setzt die Textfarbe auf weiß */ border-radius: 0 5px 5px 0; /* Obere rechte und untere rechte Ecken sind abgerundet */ } #mySidenav a:hover { left: 0; /* Beim鼠标悬停, zeigt das Element sich wie es sollte */ } /* about-Link: 20px von der Oberkante, grünem Hintergrund */ #about { top: 20px; background-color: #04AA6D; } #blog { top: 80px; background-color: #2196F3; /* Blau */ } #projects { top: 140px; background-color: #f44336; /* Rot */ } #contact { top: 200px; background-color: #555 /* Hellgrau */ }
Related pages
Tutorial:CSS navigation bar
- Previous page Canvas outside menu
- Next page Sidebar with icons