Content must work in both portrait and landscape orientation
This experimental check finds CSS that rotates the page to force one screen orientation. Content must work in portrait and landscape, unless one orientation is truly essential, such as for a piano keyboard app.
Experimental
| Rule ID | css-orientation-lock |
|---|---|
| Impact | Serious |
| Success criterion | 1.3.4 Orientation · AA |
| Standards | WCAG 2.1 · WCAG 2.2 · EN 301 549 |
| Needs a change in the website’s code |
Example
<style>
@media (orientation: portrait) {
.booking-app { transform: rotate(90deg); }
}
</style>
<main class="booking-app"><h1>Book a table</h1></main>On a tablet mounted upright, the booking form appears sideways and is hard to read or tap.
<style>
@media (orientation: portrait) {
.booking-app { padding: 1rem; }
}
</style>
<main class="booking-app"><h1>Book a table</h1></main>The form fits the screen whichever way the device is held or mounted.
Why it matters
Some people cannot turn their device. A wheelchair user may have a tablet fixed to the chair in one position, and someone with limited hand movement may use a phone in a stand. If your site only works in landscape and their device is mounted upright, the content appears sideways or not at all.
Other people choose an orientation for good reasons: a person with low vision may prefer landscape to get larger text, and a person using a phone one-handed may keep it upright. WCAG 1.3.4 asks you to respect that choice, unless a specific orientation is essential to the task.
How to fix it
Let the layout adapt instead of rotating it.
Remove rotation inside orientation queries. Delete transform: rotate(90deg) or rotate: 90deg from rules in @media (orientation: …) blocks. Use those queries to adjust the layout, not to turn it:
<style>
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
@media (orientation: landscape) {
.gallery { gap: 2rem; }
}
</style>
Check your scripts and manifest. Don't call screen.orientation.lock(), and leave out the orientation field in a web app manifest, unless the orientation is essential.
A suggestion is fine, a lock is not. If a game or chart is easier to use in landscape, you may say so, but keep the content usable in portrait too:
<p class="hint">Tip: turn your phone sideways for a larger view of the seating plan.</p>
Essential cases. Real exceptions are rare: a piano app, a cheque-scanning screen or a virtual reality view. Document why the orientation is essential, and keep every other page flexible. Test by rotating a real phone and tablet with the system rotation lock switched off.
Checklist
- Remove rotate transforms inside orientation media queries.
- Avoid screen.orientation.lock() and manifest orientation locks.
- Test every page on a phone in portrait and landscape.
- Suggest an orientation instead of forcing one.
How the check works
The check reads the page's stylesheets and looks inside @media rules that test orientation: portrait or orientation: landscape. It fails when such a rule rotates an element by about 90 or 270 degrees with transform or rotate; 180-degree turns are ignored. The check is experimental. It cannot read stylesheets it has no access to, and it does not see script or manifest locks, so test on a real phone in both orientations.
Resources
- Understanding 1.3.4 Orientation W3C
- W3C ACT rule b33eff W3C ACT
- Designing for web accessibility: tips W3C WAI
Updated October 27, 2026