Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
CSS media queries help with hiding elements again.?
I'm not used to CSS media queries obviously.
I have a mobile menu container which is hidden when the desktop is greater than 800px any less than that the desktop menu hides and the mobile appears.
My problem comes when the mobile menu is activated then the browser is expanded the mobile menu remains I need to be hidden even if its been opened. My media query goes along the lines of
@media (max-width: 800px)
I don't know if I'm using the correct media query or what but any help and advice is welcome and thanks for any input.
Well everyone who has a windows 7+ PC can snap screens left and right so 10-20 million plus people have a purpose built feature into their OS which shrinks and expands the browser.
3 Answers
- ChrisLv 75 years ago
What do you mean, "the browser is expanded"? Who actually does that in the real world? When you go into Chrome's dev mode, Chrome even tells you to reload the page after resizing, exactly for the reason that some elements might not respond correctly.
I get that you want it to be perfect but imo this is a waste of time.
If you absolutely must create a page that even works correctly if some idiot tries to actively break it, handle window.onresize using JavaScript of jQuery.
Edit after update:
Of these millions of people, 99,99% have no idea this feature even exists. Those that know it exists will use it in very specific cases, where they need two windows side-by-side.
Anyway, I already told you how to fix this: window.onresize
- larrybud2004Lv 65 years ago
That's not what media queries do. Why would you want to prevent someone from using your full site if they expand the window beyond 800 pixels?
I mean, the whole purpose of media queries is to handle this automatically.
If you want to detect whether the user is on a mobile or desktop, then you need to look at the max-device-width property. Take a look at this site:
- 5 years ago
It is a best practice to design mobile first. So design with the mobile menu, then add a breakpoint when things start to look awkward as you scale the window width. It should be along the lines of @media (min-width: 800px) then you take it away and adjust as needed, etc.