2017-04-04 3 views
-3

Ich habe ein Dropdown-Menü erstellt und funktioniert gut, außer ich kann nicht in der Lage sein, Padding in das Untermenü hinzuzufügen, ich versuche, es zu den innersten Li-Element hinzufügen, aber es funktioniert nicht aus irgendeinem Grund. Ich habe versucht, die ul und li hinzufügen Padding und keiner funktioniert. Weiß jemand, was das Problem ist, dass ich vermisse?Warum funktioniert diese Polsterung nicht?

https://jsfiddle.net/x0L1o242/28/

#mainMenu{ 
    display: flex; 

} 
li{ 
    list-style-type: none; 
} 
.dropDownMenu{ 
    border: 1px solid black; 
    border-radius: 5px; 
    background-color: blue; 
    color: white; 
    position: relative; 
    padding: 5px; 
} 
.dropDwonMenu li{ 
    padding: 30px;//part that isnt working 
} 
.dropDownMenu ul{ 
    position: absolute; 
    top: 30px; 
    left:0px; 
    visibility: hidden; 
    background-color: lightblue; 
    text-align: center; 
    padding: 0; 
} 

.dropDownMenu:hover ul{ 
     visibility: visible; 
} 
+0

wegen Ihrer Tippfehler ".dropDwonMenu li" –

+2

Es ist, weil Sie geschrieben 'dropDownMenu' falsch für das li – Pete

Antwort

-2

Sie typo'd DropDownMenu in Ihrem CSS.

Original-

.dropDwonMenu li{ 
    padding: 30px;//part that isnt working 
} 

Dieses funktioniert

.dropDownMenu li{ 
    padding: 30px;//part that isnt working 
} 
+0

dank ich es apprecate Lektion gelernt dont Code und Post auf Stack über Flow wenn halb schlaf lol – alexis

0
//Try This Css 

#mainMenu{ 
    display: flex; 

} 
li{ 
    list-style-type: none; 
} 
.dropDownMenu{ 
    border: 1px solid black; 
    border-radius: 5px; 
    background-color: blue; 
    color: white; 
    position: relative; 
    padding: 5px; 
} 


.dropDownMenu li { 
    padding: 10px; 
    width: 100px; 
} 
.dropDownMenu ul{ 
    position: absolute; 
    top: 30px; 
    left:0px; 
    visibility: hidden; 
    background-color: lightblue; 
    text-align: center; 
    padding: 0; 
} 

.dropDownMenu:hover ul{ 
    visibility: visible; 
}