-
Notifications
You must be signed in to change notification settings - Fork 707
[css-grid-1] Flex like control over grid items #1344
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
Comments
As this is my first issue in this repository, please let me know if I should provide additional information to elaborate the proposal |
You can use BTW, |
Thanks for the comment @mrego As What I believe is, that a
Totally, and if I could assign .item{
grid-column: 2fr;
} |
As far as I can tell, @mrego solved your problem properly. If you want the item to be the size of two columns, you just give it a span of 2. If you want the aside to move down to the next line when it's small enough, you need to use a media query to change the layout of the grid and/or the position of the items. |
@tabatkins I totally agree, a media query would do the trick. What I'm proposing is a way to solve the problem without a media query. If this is something, css-grid isn't designed for I'm happy to close the proposal. |
Your desired grid in the previous comment changes quite a bit - some cells switch from being one column wide to two columns wide, "Activity" switches from two rows tall to one row tall, etc. That's some pretty non-trivial changes; I don't think it can reasonably be automatically handled. Even if you did produce something that happened to cleanly work, there's a lot of nearly-adjacent possibilities that won't, so it'll probably turn out fairly fragile. :( Really, one of the great values of Grid is how easy it is to dramatically rearrange the grid in a MQ, to accommodate different amounts of space. This allows a lot of interesting possibilities that can't be cleanly expressed in a single reactive description. This really is just "use Media Queries". ^_^ |
I'm referring to the grid-column shorthand.
I tried to implement a grid where the children adapt to the size of the container.
At one point I expected a grid item to behave similar to what we know from the the flex-grow property.
Test case: https://codepen.io/lassediercks/pen/XRZbBo
Above 935px the grid looks fine,
Belove 935px I expect the
.aside
div to flow to the next lineThe purpose of this issue is a proposal to add a behaviour similar to flex:
When our container looks like this
and a grid-item like this
We can expect
.item
to have the width of2*minmax(250px, 1fr)
The text was updated successfully, but these errors were encountered: