Designing for Dual Screen and Foldable Devices with CSS (2023)
Recorded: Sept. 12, 2026, 5:09 a.m.
| Original | Summarized |
Designing for Dual Screen and Foldable Devices With CSS - Stephanie Stimac's Blog Portfolio Designing for Dual Screen and Foldable Devices With CSS Published on Tags 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. The horizontal-viewport-segments query targets the device when it is being held like a book and the two screens are side-by-side. The x and y positions represent the two-dimensional grid created by hardware features that separate each viewport segment, with the coordinates 0,0 starting at the top-left segment. .container { } This line of code means that the first grid column will take up the entirety of left display when the device is held in the vertical position (like a book), and the second grid column will take up the remaining width of the display space available, which is the display on the right. .container { } Again, this means that each column takes up a display. Pretty sweet. ← Home Affiliate Notice Follow Me © 2026. Stephanie Stimac - All rights reserved. |
Stephanie Stimac explores the technologies available for designing and developing experiences that adapt to foldable devices, focusing on native web and application development using CSS. She addresses the possibility of adapting designs for dual-screen layouts, setting aside initial resistance to the new form factor and focusing instead on current technological feasibility and potential user delight. Stimac introduces two primary methods for targeting the unique geometry of foldable devices using Cascading Style Sheets. The first method involves using CSS Media Queries for Viewport Segments, which allows targeting the device's configuration based on how the screens are arranged. Specifically, there are media queries for horizontal viewport segments and vertical viewport segments. The horizontal-viewport-segments query is designed for devices held side-by-side, mimicking a book layout, while the vertical-viewport-segments query targets devices where the screens are stacked, resembling a laptop. The second, more powerful technique involves utilizing CSS Environment Variables to acquire the precise geometry of each display. A set of environment variables is proposed to capture the spatial data separating the viewport segments, including variables for width, height, top, left, bottom, and right coordinates. These variables are calculated by the device hardware, meaning they inherently adjust dimensions based on the specific hinge and screen dimensions of any given foldable device, thereby eliminating the need to create bespoke designs for every unique device configuration. These environment variables also provide a framework for positioning and placing content across the two physical screens. Stimac demonstrates how these techniques can be applied practically, utilizing CSS Grid to implement dynamic layouts. For instance, she shows how the media queries can control the grid structure, enabling dynamic changes in column definitions. By using environment variables as values for grid templates, designers can define how content spans across the distinct screen areas. For example, when targeting a horizontal mode, the grid template columns can be defined using the width variables of the respective viewport segments, allowing the layout to automatically allocate space based on the physical screen dimensions. The rationale for incorporating dual-screen design into product development centers on market relevance and user experience. Although some initially opposed this direction, Stimac suggests that it is beneficial to assess user requirements and market trends, such as the projected high volume of foldable devices, to guide design decisions effectively. Furthermore, designing adaptable experiences can be a means to differentiate a product and enhance user satisfaction. Regarding implementation, Stimac notes current browser support limitations, stating that the media queries and environment variables are currently supported in Microsoft Edge Stable. She points out that Chrome Stable does not currently offer this support natively, although experimental flags can be used to test functionality. Stimac concludes by emphasizing that while these capabilities exist for enhancing foldable web and app experiences, widespread browser and operating system support is crucial. This support is necessary to ensure that developers and designers are incentivized to seriously pursue the innovation of adaptable layouts as new foldable devices continue to be released. |