Hide Content Based on Device Orientation?

berlin80210
13 years, 4 months ago
Is there a way to hide/show content based on the way a phone is oriented? (i.e. Portrait versus Landscape)

Thanks in advance!
dryabov
13 years, 4 months ago
There are 2 solutions:
1. Use of css media queries
@media (orientation:portrait) { ... }
@media (orientation:landscape) { ... }


2. Use of javascript to do something depending on window.orientation property (and handle orientationchange or resize events).

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.