Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mediaqueries-5] Logical Media Queries #10156

Open
brandonmcconnell opened this issue Mar 28, 2024 · 2 comments
Open

[mediaqueries-5] Logical Media Queries #10156

brandonmcconnell opened this issue Mar 28, 2024 · 2 comments

Comments

@brandonmcconnell
Copy link

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.

@KennethHoff
Copy link

KennethHoff commented Apr 12, 2024

Should these not be {max-/min-}block-size and {max-/min-}inline-size respectively?

@brandonmcconnell
Copy link
Author

Should these not be {max-/min-}block-size and {max-/min-}inline-size respectively?

@KennethHoff Perhaps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants