Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS List-Items Not Displaying Below Each Other

Tags:

jquery

css

list

I have spent the last 3 days creating a menu structure which is generated from a database. It works perfectly with the exception of my styling of my List-items. I have coloured the background of the problem area in Red, and these areas show when you hover over the words

Bus Stops
Employees
Fences
Vehicles

The list-items within these red boxes are displaying alongside each other rather than vertically below each other. I cannot for the life of me work out why?

I have created a fiddle to illustrate my problem: http://jsfiddle.net/devin85/tMYxT/4/

I have also set the background color to Red in the Javascript section to help show where the hover event is occurring, and save any good Samaritan the time of searching the code.

Please someone help! Thanks in advance.

like image 348
user1434739 Avatar asked Nov 23 '25 03:11

user1434739


2 Answers

Its because of your CSS.

When you declare

#navigation li, .headerRight li { margin: 4px 7px 4px 2px; padding: 0px; float: left; background-color: Transparent; }

you're telling the browser to float left all of the li's under navigation until you tell it otherwise.

#navigation .submenu .submenu li {
   float:none;
}

will tell it not to float on all the list items when their in a second level submenu.

like image 67
user694844 Avatar answered Nov 25 '25 00:11

user694844


If you add this line to the end of your css file it'll stop those ones floating left:

#navigation .submenu li .submenu li {
    float:none;
}
like image 24
Billy Moat Avatar answered Nov 24 '25 23:11

Billy Moat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!