March 25th, 2021 at 17:17 #115907
Hi, I’ve created a staging site and would like to hide the menu in landscape mode when the website is viewed using a mobile browser. You’ll need a passcode to enter.
Currently tested with a Samsung S20+ on Android 11 with chrome version 89.0.4389.105
March 27th, 2021 at 17:39 #115988ZedCryout Creations Team
- This topic was modified 1 month ago by Avin.
There is no perfect CSS method of targeting browsers depending on the medium they run on (mobile/table/desktop). Generally, CSS is able to target devices depending on screen size: https://stackoverflow.com/questions/6370690/media-queries-how-to-target-desktop-tablet-and-mobile
Browser detection is usually done with JS or through code, and even then it isn’t perfect since browser useragent strings can be manipulated.
For a mobile device in landscape mode you’d want to target a screen size between the largest portrait mode you want the menu to remain visible on and the smallest desktop you’d also want a menu visible one. This approach is bound to overlap some less common situations (like tables in portrait mode or ultra portable laptops).
You need to log in to reply to this topic.