W3C home > Mailing lists > Public > www-style@w3.org > November 2008

[css3-layout][css3-grid] Meshing Template Layout with Grid Layout

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 26 Nov 2008 09:31:45 -0600
Message-ID: <dd0fbad0811260731o4a804523y8580968650a680ff@mail.gmail.com>
To: www-style <www-style@w3.org>

In the Grid Positioning Module[1] section 8.3, it is suggested that
the Advanced Layout Module[2] needs to specify how template layout
interacts with grid layout.  Since this hasn't yet been done, but I
have high hopes for both modules, I want to move this forward.

An element with template implicitly establishes a grid in a
straightforward way.  The row-heights, taken together, map directly to
a grid-rows declaration, and the same with column-widths and
grid-columns.  Example:
The template layout declaration...
display:
  "aa" /200px
  "bc" /2em
  "bd"
  200px;
...establishes an implicit grid equivalent to the following explicit
declaration:
grid-rows: 200px 2em *;
grid-columns: 200px *;

There are two points of conflict, one in either direction.

1)  Template layout allows a row to have "intrinsic" height, where the
height is determined by the content rather than being fixed
explicitly.  Grid positioning has no concept of a grid row having
intrinsic height.  This isn't necessarily a problem (tables and
multicol elements run into the exact same issue), it just means that
the mapping isn't round-trippable; the implicit grid row has a height
equal to the computed height of the template row after layout
calculations have been performed.

2)  Grid positioning explicitly utilizes a flex unit in its grid
rows/columns declarations, with the unit name of "*".  Template layout
only brushes on this, effectively limiting you to only using 1* in
your layouts.  One can still *fake* a full flex unit just by
increasing the number of rows/columns (frex, display: "aab" * * *;
would result in the same thing as display: "ab" 2* *;), so we're not
saving any implementation complexity by forgoing the full flex unit,
so why not embrace it?  As a bonus, this may allow the use of
non-integral flexes (grid touches on this), which can again be faked
with a 1* unit, but can require very large numbers of columns/rows.

I'm not sure if it's useful or not, but the ::cell pseudo-elements can
then use grid units in their properties (border is the only one that
really pops to mind as being able to put it to use).

~TJ
Received on Wednesday, 26 November 2008 15:32:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:17 GMT