Re: [csswg-drafts] [css-grid] Property "grid-item-of": display any element as part of any given grid (#2530)

> ... regions ...

Sorry, regions are out of scope for this here issue.

And yes, Regions should get revived.

> what happens when the value of grid-item-of applies to more than one element

Two aspects:

```
.any_selector.pointing_to_the_grid {
  display: grid;
  /* Any additional normal Grid stuff here: */
  grid-template-columns: repeat(2, auto);
}
.any_selector.pointing_to_the_elements {
  grid-item-of: .any_selector.pointing_to_the_grid;
  /* The elements get auto-placed in the grid as if it were appended as grid child. */
  /* Optional: Where to place them in the Grid: */
  grid-row: 1;
  grid-column: 2;
  /* Any additional Grid item properties here. */
}
```

The elements get auto-placed in the grid as if they were appended as grid children.

If there's code below "Optional: Where to place them in the Grid:", then they get placed in that same place and do overlap - which might may well be intended by the CSS author. But typically the CSS author would use `grid-item-of` for one element (plus placement code such as `grid-row` & `grid-column`). There also could be syntax for applying `grid-item-of` to multiple elements and placing each one differently, but that might become a bit complex. It'd be simpler to do `grid-item-of` plus optional placement code (eg `grid-row` & `grid-column`) for each of the multiple elements (and for a spec to support only that).

What happens if the value of `grid-item-of` points to more than one grid? It'd be an error. The feature wish is to be able to add an element to a grid although the element is not a child of that grid element. The element can not get added to two grids. One way of handling that error would be to add it to the first of the referenced grids (in document order).

-- 
GitHub Notification of comment by tobireif
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2530#issuecomment-458088798 using your GitHub account

Received on Monday, 28 January 2019 11:11:01 UTC