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

Change grid columns based on container width #19

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

bennothommo
Copy link
Member

This leverages the new @container query, which is present in the latest versions of all major browsers, and allows us to dynamically set the column count based on of the width of the parent container.

This means that if a repeater is used within another block that constricts the width (say, a two column layout), this will shrink the number of columns. The target is to give each column a minimum of roughly 400 pixels.

My understanding is that browsers that do not yet support this query will simply ignore it, which will fall back to using the viewport media queries.

This leverages the new [@container](https://developer.mozilla.org/en-US/docs/Web/CSS/@container) query, which is present in the latest versions of all major browsers, and allows us to dynamically set the column count based on of the width of the parent container.

This means that if a repeater is used within another block that constricts the width (say, a two column layout), this will shrink the number of columns. The target is to give each column a minimum of roughly 400 pixels.

My understanding is that browsers that do not yet support this query will simply ignore it, which will fall back to using the viewport media queries.
@LukeTowers LukeTowers merged commit 3da59a5 into main Aug 28, 2023
6 checks passed
@LukeTowers LukeTowers deleted the fix/column-container-widths branch August 28, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants