The orientation CSS descriptor controls the orientation of a document defined by @viewport.

/* Keyword values */
orientation: auto;
orientation: portrait;
orientation: landscape;

For a UA/device where the orientation is changed upon tilting the device, an author can use this descriptor to inhibit the orientation change.

Related at-rule@viewport
Initial valueauto
Percentagesrefer to the size of bounding box
Mediaas each of the properties of the shorthand:
Computed valueas specified
Canonical orderthe unique non-ambiguous order defined by the formal grammar



The user agent will set the document's orientation automatically, typically based on the device's orientation as determined by an accelerometer (if the device has such a hardware sensor), although there is often a user-controlled, OS-level "Lock orientation" setting that will trump the accelerometer reading.
The document should be locked into portrait orientation.
The document should be locked into landscape orientation.

Formal syntax

auto | portrait | landscape


Specification Status Comment
CSS Device Adaptation
The definition of '"orientation" descriptor' in that specification.
Working Draft Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No ? No10 -ms- No ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support ? ? ? ?8 -o- ? No

Document Tags and Contributors

Contributors to this page: fscholz, mfluehr, rwilson.or, mrenty, Sebastianz, ndugger, cvrebert
Last updated by: fscholz,