0

I am trying to create a media query to identify if a screen is landscape or portrait so that I can change the CSS styling when a screen is rotated. Is this possible and how would i do it?

1 Answer 1

0

Check out the orientation feature.

@media screen and (orientation: landscape) {
    /* ... */
}

@media screen and (orientation: portrait) {
    /* ... */
}

Side note, this question definitely belongs on StackOverflow instead since it's implementation-specific.

1
  • Thanks for the answer. Works well! Thanks also for guidance on StackOverflow - new to a lot of this so will check it out. Jan 25, 2021 at 11:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.