-
Notifications
You must be signed in to change notification settings - Fork 756
Open
Labels
Description
Reference: https://drafts.csswg.org/css-grid-2/#subgrids
Issue:
When subgrid is used on a container whose parent does not have a grid declared, there is no way to provide alternate grid lines as a fallback. Using the cascade as in the example below does not work because even without the parent grid, the subgrid declaration is still valid.
.subgrid {
grid-template-columns: repeat(4, 1fr); /* fallback does not work*/
grid-template-columns: subgrid;
}Expected behavior
Provide grid line fallbacks for subgrid when a parent grid is not present.
Example:
grid-template-columns: subgrid, repeat(4, 1fr);Scenario
A component uses the parent grid if it is present through conditional subgrid. If the parent has a grid, the subgrid applies, otherwise the component uses its own grid lines.
Sandbox
I've built a rudimentary example to demonstrate the above scenario:
https://codepen.io/mor10/pen/ZEyVpZb
jacty, mirisuzanne, joliss and CanRau