|
|||
Responsives Drop-Down Menu
Servus Leute,
ich habe ein kleines Problem. Und zwar versuche ich gerade ein responsives Drop-Down-Menu zu coden, bei dem die Menü-Leiste ab einer gewissen Seitenbreite (für Mobilansicht) zum typischen "Aufklapp-Menü-Balken" wird. Dieser Part funktioniert soweit auch. Allerdings klappt das Untermenü bei mir immer innerhalb des Navigations-Balkens auf und vergrößtert diesen dadurch nach unten. Setze ich Code:
nav ul li ul { position: absolute; } Seids bitte gnädig mit mir - blutiger Anfänger hier Schonmal vielen Dank für die Hilfe! Hier noch der code: HTML-Code:
<nav> <ul> <li> <a href="downloads.php">Downloads</a> <ul> <li>Untermenü<li> </ul> </li> <li><a href="forum.php">Forum</a></li> <li><a href="contact.php">Contact us</a></li> <li><a href="">Home ▾</a></li> <li><a href="" style="color: orange">Login</a</li> </ul> <div class="handle"> Menu </div> </nav> Code:
<script> $('.handle').on('click', function(){ $('nav ul').toggleClass('showing'); }); </script> Code:
body { margin: 0; padding: 0; background-color: #F2F2F2; font-family: 'Yanone Kaffeesatz', sans-serif; } nav ul { background-color: #34342D; overflow: hidden; color: white; margin: 0px; padding-left: 10%; -webkit-transition: max-height 0.4s; -ms-transition: max-height 0.4s; -moz-transition: max-height 0.4s; -o-transition: max-height 0.4s; transition: max-height 0.4s; } nav ul li { display: inline-block; padding: 15px 15px; border-bottom: 3px solid #34342D; float: left; } nav ul li ul { display: none; } nav ul li :hover < ul{ display: block; top: 0; margin: 0; padding } @media screen and (max-width: 550px) { nav ul{ width: 100%; padding-left: 0px; text-align: left; max-height: 0px; border: none; } .showing { max-height: 30em; } .handle { display: block; float: left; } nav ul li { box-sizing: border-box; width: 100%; padding: 15px; border: none; } nav ul li ul li{ display: none; } } |
Sponsored Links |
Themen-Optionen | |
Ansicht | |
|
|
Ähnliche Themen | ||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
CSS drop down menu ul li komme nicht weiter. | boogy | CSS | 0 | 25.10.2012 14:53 |
Hilfe css Menu center | xXcyberXx | CSS | 5 | 28.11.2010 19:51 |
Drop Down Menu Positionsproblem | Schky | CSS | 4 | 21.04.2008 13:09 |
Drop Down Menu: focus Problem | enoo | CSS | 8 | 20.03.2007 17:51 |