Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

Should a website force portrait or landscape orientation?

Illustration without a description Illustration without a description

Most websites should allow both portrait and landscape orientation. People rotate devices for larger text, a wider keyboard, mounted use or personal comfort. An orientation lock can block access for users who cannot physically rotate their device. Responsive layout is the safer default for ordinary content, commerce and forms.

 

Orientation locking is better suited to narrow cases such as a full-screen game, camera experience or instrument whose controls depend on one physical arrangement. Even then, provide an explanation and a usable fallback when the lock request fails. Browser support and permission conditions vary, and the API may require full-screen or an installed web app context.

 

The Screen Orientation API exposes screen.orientation.lock() and returns a promise. Handle rejection without trapping the interface. Do not repeatedly request a lock after the user declines or leaves full screen. Unlock when the specialized experience ends so the rest of the site follows the device again.

 

async function enterGame() {
try {
await document.documentElement.requestFullscreen();
await screen.orientation.lock('landscape');
} catch (error) {
showOrientationHint();
}
}

 

A CSS orientation query changes presentation; it does not force the hardware orientation. Use it to rearrange controls or reduce tall decorative sections. Avoid overlays that block the entire page with a rotate-device message. If one feature works best horizontally, keep navigation and exit controls available in portrait.

 

Test the experience with device rotation disabled at the operating-system level, in split-screen modes and on tablets with a keyboard. Check zoom and assistive technology. The page should never become unusable because an orientation request is unavailable, rejected or contradicted by the user’s device settings.