The orientation
CSS media feature can be used to test the orientation of the viewport (or the page box, for paged media).
Note: This feature does not correspond to device orientation. Opening the soft keyboard on many devices in portrait orientation will cause the viewport to become wider than it is tall, thereby causing the browser to use landscape styles instead of portrait.