by Tab Atkins Jr. (Google)
at CSS WG Blog
.grid { display: grid; grid-template-columns: 200px 1fr; grid-template-rows: 100px 1fr auto; } .title { grid-column: 1; grid-row: 1; } .menu { grid-column: 1; grid-row: 2 / span 2; } .main { grid-column: 2; grid-row: 1 / span 2; } .footer { grid-column: 2; grid-row: 3; }
display: grid
: Defines a grid container.grid-template-columns
and grid-template-rows
: Specify the track breadths.grid-column
and grid-row
: Determine a grid item's size and location within the grid.<div class="grid"> <div class="title">Title</div> <div class="menu">Menu</div> <div class="main">Main</div> <div class="footer">Footer</div> </div>
fr
- free space - unit)max-content
min-content
minmax(min, max)
auto
.grid { display: grid; grid-template-areas: "title title title social" "menu main main social" "menu main main social" "footer footer footer footer"; } .title { grid-area: title; align-self: center; justify-self: center; } .menu { grid-area: menu; align-self: start; } .main { grid-area: main; } .social { grid-area: social; align-self: end; justify-self: right; } .footer { grid-area: footer; align-self: start; }
grid-template-areas
specifies named grid areas that can be referenced to position grid items.by Beth Dakin (Apple) and Mihnea-Vlad Ovidenie (Adobe)
at Surfin' Safari - The WebKit Blog
.source { flow-into: content-1; } .region { flow-from: content-1; }
flow-into
property places an element into a named flow.flow-from
converts a block in a region and associates it with a named flow.<div class="source">Lorem ipsum dolor sit amet...</div> <div class="region" id="region-1"></div> <div class="region" id="region-2"></div> <div class="region" id="region-3"></div>