Skip to content

[mediaqueries-5] Logical Media Queries #10156

Open
@brandonmcconnell

Description

@brandonmcconnell

Abstract

This proposal introduces new media queries that are based on the logical inline and block dimensions of the viewport, rather than width and height. This aligns with the growing support for logical styles in modern web development.

Motivation

Current CSS media queries are based on the width and height of the viewport, which can be problematic when dealing with layouts that are not constrained to a single axis (e.g. responsive designs, rotated screens, internationalization, etc.). This proposal aims to provide a more flexible and logical way to target styles based on the inline and block dimensions of the viewport.

Proposed Media Queries

block inline
range (min-block: <size>)
(max-block: <size>)
(min-inline: <size>)
(max-inline: <size>)
operator (block > <size>)
(block >= <size>)
(block < <size>)
(block <= <size>)
(inline > <size>)
(inline >= <size>)
(inline < <size>)
(inline <= <size>)

Use Cases

  • Targeting styles based on the logical dimensions of the viewport, rather than the static w/h viewport dimensions
  • Creating layout-agnostic styles that work well in both landscape and portrait orientations
  • Designing responsive components that can adapt to changes in the viewport's logical dimensions, especially useful in the case of internationalization

Conclusion

This proposal aims to introduce a more logical and flexible approach to media queries in CSS, aligning with the growing trend towards layout-agnostic web design. By focusing on the inline and block dimensions of the viewport, rather than the physical width and height, developers can create more robust and adaptable styles for a wide range of device and layout scenarios.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions