
Orientation is an often overlooked aspect of web experiences. Visitors may want to print a wide table or chart in landscape mode so it fits on the page, while mobile users constantly rotate their devices between portrait and landscape. For developers, orientation affects print stylesheets, responsive layouts, and interactive applications like games and video players. This guide explains how to change the orientation of a web page as a user and how to control orientation behavior as a developer.
Adaptive Web Experiences From AAMAX.CO
Websites today must look great in every orientation, on every device, and even on paper. AAMAX.CO is a full service digital marketing company that offers web development, digital marketing, and SEO services worldwide. Their developers build flexible layouts and print-friendly pages that adapt intelligently to how users view and share content. For interactive tools and dashboards, their web application development services deliver interfaces that work flawlessly in portrait, landscape, and print formats.
Part 1: Changing Orientation When Printing a Web Page
Print in Landscape in Google Chrome and Edge
Press Ctrl and P on Windows or Command and P on Mac to open the print dialog. In the settings panel, find the Layout option and select Landscape. The preview updates immediately so you can confirm that wide content fits. You can also adjust scale, margins, and whether to print background graphics under More settings.
Print in Landscape in Firefox
Open the print dialog with the same keyboard shortcut. Firefox displays an Orientation option where you can choose Portrait or Landscape. Additional settings let you scale content to fit the page width and adjust margins.
Print in Landscape in Safari
In Safari on Mac, choose File, then Print. Click Show Details if the full options are hidden, then select the landscape orientation icon. Safari also lets you adjust scaling and choose whether to print backgrounds.
Save a Web Page as a Landscape PDF
To create a landscape PDF, open the print dialog, choose Save as PDF or Microsoft Print to PDF as the destination, set the layout to Landscape, and save. This is useful for sharing reports, invoices, or wide tables in a portable format.
Part 2: Controlling Print Orientation With CSS
Developers can suggest a default print orientation using the CSS @page rule:
@page {
size: landscape;
margin: 1cm;
}Supported browsers will default to landscape when printing the page. You can also use named pages to make only certain sections print in landscape, which is helpful for documents that contain wide tables alongside normal text. Combine this with a print media query to hide navigation, ads, and buttons, and to optimize typography for paper:
@media print {
nav, footer, .no-print { display: none; }
body { font-size: 12pt; color: #000; }
}Part 3: Handling Device Orientation on Mobile
Rotate Your Device
For users, changing orientation on a phone or tablet is as simple as rotating the device, provided rotation lock is turned off. On iOS, open Control Center and toggle the orientation lock. On Android, use the quick settings panel to enable auto-rotate.
Use CSS Orientation Media Queries
Developers can apply different styles based on whether the viewport is taller or wider:
@media (orientation: landscape) {
.gallery { grid-template-columns: repeat(4, 1fr); }
}
@media (orientation: portrait) {
.gallery { grid-template-columns: repeat(2, 1fr); }
}Note that orientation media queries respond to viewport proportions, not physical device orientation, so a narrow desktop browser window also counts as portrait.
Detect Orientation Changes With JavaScript
The Screen Orientation API exposes the current orientation through screen.orientation.type and fires a change event when it changes. You can also use window.matchMedia with an orientation query to respond to changes in JavaScript. This is helpful for adjusting canvas sizes, reflowing charts, or pausing interactive content.
Lock Orientation for Apps and Games
Some experiences, like games or video players, work best in a specific orientation. The Screen Orientation API's lock method can lock orientation, but browsers generally require the page to be in full-screen mode or installed as a progressive web app. For installed PWAs, you can set a preferred orientation in the web app manifest. Use locking sparingly, since forcing orientation can frustrate users and conflict with accessibility needs.
Avoid Rotating Content With CSS Transforms
Rotating an entire page with CSS transforms to simulate a different orientation usually creates usability problems, including awkward scrolling and broken interactions. Instead, design responsive layouts that adapt naturally to both orientations.
Test Both Orientations
Use browser developer tools to toggle between portrait and landscape when simulating mobile devices, and test on real hardware whenever possible. Pay attention to fixed headers, modals, and on-screen keyboards, which can take up significant space in landscape mode.
Conclusion
Changing the orientation of a web page can mean printing in landscape, defining print orientation with CSS, or adapting layouts as devices rotate. Users can switch orientation easily through print dialogs and device settings, while developers can use @page rules, orientation media queries, and the Screen Orientation API. With thoughtful design, your pages will look great whether viewed upright, sideways, or on paper.