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

Maria Cuan
Maria Cuan
4,500 Points

Responsive Menu wont work on smaller resolutions.

Hello treehouse,

Please help me figure out what is wrong with my css code. The menu works perfectly on higher resolutions but once you shrink the browser size to mobile devices it won't work any more. I have tried everything in my css. The main class that works my menu is called

 nav 

I have tried adding:

header 

but it wont work, it just layers an unnecessary box on top of my nav class.

My link is this

www.esthercuan.com/one_martial

Thank you for any help you can provide. You guys are awesome!

4 Answers

Hi Maria,

I hope I'm looking at the right problem here.

I think the offending css code is your transform here:

#navigation {
    margin: 0 auto;
    opacity: 0;
    padding-top: 1.5em;
    transform: translate(0px, -700px);
    transition: transform 0.15s ease 0s, opacity 0.7s ease 0s;
}

At wider widths moving it up 700px is enough to get it off screen because the .grid items are layed out horizontally and the element isn't very tall. At smaller widths though this element gets to be more than 700px tall and so you end up not quite moving it all the way off the top of the screen. So when you click on that strip on the top you're clicking on the #navigation element which you have some code which prevents the click from bubbling up.

So the nav element never receives the click.

You could try increasing the -700px but I suppose you're always running the risk of this happening. You should think about a more reliable way of getting it off screen.

Or maybe instead of having these overlapping click areas with your nav and #navigation elements which cause a conflict you could have your .site-width element be a full width strip at the top and dedicated to opening and closing the menu. Then your #navigation element can slide down and up as needed.

Then you shouldn't need the .stopPropagation code you have for #navigation.

I'd love to see an answer for this. I wish I could help... I have to learn more CSS!

Maria Cuan
Maria Cuan
4,500 Points

Me too, please help.

Maria Cuan
Maria Cuan
4,500 Points

Thank you so much for your help!