Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Erik Krieg
Erik Krieg
43,038 Points

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,682 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.