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 Responsive Layouts Responsive Patterns Responsive Design Patterns

Switching from hamburger in mobile to horizontal navigation in larger screens with media queries

I am trying to figure out how to use media queries to switch from my horizontal navigation (used for large screens), or a hamburger type navigation for mobile screens. Any tips?

do you have any code you are working on, or is this a general question?

5 Answers

Your media queries will simply need to hide your navigation links and show a hamburger button while at smaller screen widths. This part is fairly simple. But to make it actually work, as in, open and close your menu when you click the hamburger button, you will most likely need to use JavaScript.

If you have no experience with JS, I suggest checking out some tutorials on jQuery, like this one.

Jordan Davis
Jordan Davis
7,696 Points

Geat read! definitely recommend reading this article, very insightful!

Cody Craig
Cody Craig
10,326 Points

I am not sure what you are aiming to do with it. As Erik said, there are quite a few options that use JavaScript. However, there are some css only options that are worthwhile checking out too. Try searching pure css off canvas menus.

Thanks to Lorraine Wheat for the link to that awesome tutorial!

Piyush Patel
Piyush Patel
17,253 Points

Yeah and I think this can also be achieve with the help of CSS3 translate and display: none properties.