New layouts with CSS Subgrid
joshwcomeau.com
New layouts with CSS Subgrid
1–10 of 104 posts
Re: New layouts with CSS Subgrid
#2Re: New layouts with CSS Subgrid
#3 ul { display: contents }
it's more efficient, if you don't need subgrid features, but still want the nested element structure for other reasons.Re: New layouts with CSS Subgrid
#4Subgrid is really cool, but I want to note that for the first trivial example, you could make the children participate in grid layout by doing ul { display: contents } it's more efficient, if you don't need subgrid features, but still want the nested element structure for other reasons.
Re: New layouts with CSS Subgrid
#5Isn't this also what container queries solve better? I guess maybe you want to be sure that the whole grid remains consistent instead of relying on individual containers possibly making their own decisions. So many new features to investigate, so little time :) https://codepen.io/web-dot-dev/pen/rNrbPQw
I am sad that using containers and subgrids together doesn't work. Being able to query the size of the subgrid from a child element would be super powerful.
Re: New layouts with CSS Subgrid
#6You're killing it, Josh. Thank you for writing and teaching us.
Re: New layouts with CSS Subgrid
#7Re: New layouts with CSS Subgrid
#8Subgrid is really cool, but I want to note that for the first trivial example, you could make the children participate in grid layout by doing ul { display: contents } it's more efficient, if you don't need subgrid features, but still want the nested element structure for other reasons.
And on the second one, you could use any other unit instead of fr for the image to set its width consistently, then fr on the text to have it use up whatever remains.
Re: New layouts with CSS Subgrid
#9Re: New layouts with CSS Subgrid
#10is grid intended to replace flex at some point or live side by side