Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Drop down menu

Hi I'm pretty proficient now in all the simple things in css and html however I now want to learn more advanced things.

What I really want to master at the moment is drop down menus. They will be on pretty much every site I make so I would really like to get good a them.

Does anyone have any idea on where I should look to learn more about drop down menus or is it trial and error.

This was a useful tutorial. It doesn't show you the body styles, so I created my own.

body {
    background-color: #89a;
    display: flex;
    justify-content: center;
    font-family: sans-serif;
    font-weight: bold;
}

3 Answers

simple... <ul><li>first element </li> <li>second element </li> <li>third element <ul><li>first subelement</li></ul></li>

li ul { display:none;} li ul:hover { display:block;}

This works when hover is on the li, not on the ul (there is no ul to hover because it is not being displayed).

li ul { display: none; }

li:hover > ul { display: block; }

Oh sorry I have done a mistake ;-)

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi troy beckett,

The 2nd half of this tips video shows you how to build an HTML/CSS dropdown menu. :)

I just want to say I think its great that people that actually run the website and are experts in the field take the time to read my posts and comment. I really appreciate it.