Designing for Dual Screen and Foldable Devices with CSS (2023)

This article explores how web developers can use CSS media queries and environment variables to optimize layouts for foldable and dual-screen devices. It explains how to target specific screen segments to create responsive, multi-pane user experiences.
Why it matters
As foldable hardware becomes more common, developers need standardized methods to ensure web content remains functional and aesthetically pleasing across varying screen geometries.
With the announcement of Google's Pixel Fold , I thought its an apt time to revisit what technologies are available for designing and developing experiences that adapt to a foldable device.
Let's ignore the naysayers who vehemently don't want to design for a new form factor, while also ignoring the price of Goggle's first generation device and just focus on what's possible right now.
There are two media queries for targeting your foldable device.
@media (horizontal-viewport-segments: <count>) { } @media (vertical-viewport-segments: <count>) { } The horizontal-viewport-segments query targets the device when it is being held like a book and the two screens are side-by-side.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in