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

Hi, I want to learn how to make dropdown menus in HTML / CSS. Which course will help me accomplish this?

I have started learning HTML / CSS only recently and can make basic portfolio websites with some confidence now. Please guide about the next steps.

3 Answers

I am not sure whether there is a course on this, but you can sure find some good examples that walk you through the code online, Maybe check out http://inspirationalpixels.com/tutorials/creating-a-dropdown-menu-with-html-css

Also do realize sometimes Javascript can come in convenient for creating submenu's, and if you already know some of that, I think the Javascript solution is more readable and exciting than HTML/CSS solutions.

Cheers!

Hi

It is possible to create a dropdown menu with CSS and HTML alone, but I really wouldn't bother unless you are making something very simple with no extra features required. In my opinion the code required is a bit "hacky" and overly complex. You'll likely run into cross-browser issues, especially with older versions of IE. Worst of all, it really limits what you can achieve.

I did a lot of mucking about with this a couple of years ago, and found the results distinctly average compared to what is now considered normal UX on websites (menus collapsing / expanding, behaving differntly on desktop / mobile etc). Then, I learnt Javascript and jQuery, and haven't looked back.

In my opinion, I think it is well worth spending ten hours learning the JS and jQuery required to make a dropdown menu. The Treehouse JS Full Stack track will get you there pretty quickly (IMO, Dave McFarland's course on introductory JS is the best on Treehouse, very accessible and well presented). Moreover, if you are serious about doing further web design, you will quickly run into problems that simply can't be solved by CSS and HTML.

Good luck!