|
Multiple columns and rows layout. Close to <table> layout but does not require <tr>s and any arbitrary block element can be used as a cell.
left/top/right/bottom attributes of child elements and special grid location units (#) used for definition of block location in final grid.
Example, style block: #cell { left:2#; top:1#; right:3#; bottom:2#; }
replaces block with id="cell" in the grid so it occupies 4 cells of the grid from r1:c2 to r2:c3. Pay attention that left/top/right/bottom define positive cell position numbers that start from 1.
width and height attributes of the cell blocks define dimensions of border box of the element (normaly they are dimensiopns of the content box).
%% units calculation:
width and height of cell blocks declared in %% (or *) flex units are computed against width and height of the grid container (that has flow:grid declared). See sdk/html_samples/flows/grid***.htm samples.
paddings and borders of cell elements given in flex units are computed against dimensions of block itself. This makes possible to use for example #cell { left:2#; top:1#; right:3#; bottom:2#; padding-top:*; padding-bottom:*; } to align vertically content of the cell block to the middle.
Example, following HTML and style declarations allow to define layout similar to the table on the right:
<div #container> <p #left>Left</p><p #right>Right</p> <p #top>Top</p> </div>
div#container { flow:grid; } p#left { left:1#; top:2#; } p#right { left:2#; top:2#; } p#top { left:1#; right:2#; top:1#; }
Note: engine does not check cells for overlapping. So multiple blocks can occupy the same cell. |