SlideShare a Scribd company logo
1 of 92
Download to read offline
WHAT I DISCOVERED ABOUT
LAYOUT VIA CSS GRID
@rachelandrew #cssday
March 2017 March 2017 March 2017 March 2017 March 2017 Soooooon!
63.92%
Itā€™s not CSS Vaporware!*ā€Ø
ā€Ø
ā€Ø
*Iā€™m very happy about this
The more I know about CSS, the more
I realise I donā€™t know.
CSS Grid and friends
ā–ø CSS Display
ā–ø Writing Modes
ā–ø Logical Properties
ā–ø Box Alignment
ā–ø Feature Queries
CSS Display: https://drafts.csswg.org/css-display/
ā€œThis module describes how the CSS formatting
box tree is generated from the document
element tree and deļ¬nes theĀ displayĀ property
that controls it.ā€
CSS Display: https://drafts.csswg.org/css-display/
ā–ø The Outer Display Type - how does this box behave in relationship to its
parent?
ā–ø The Inner Display Type - what formatting context does it create for its child
elements?
CSS Grid: https://www.w3.org/TR/css-grid-1/#grid-item-display
ā€œTheĀ displayĀ value of aĀ grid itemĀ isĀ blockiļ¬ed: if
the speciļ¬edĀ displayĀ of an in-ļ¬‚ow child of an
element generating aĀ grid container is an inline-
level value, it computes to its block-level
equivalent.Ā ā€
CSS Display: https://www.w3.org/TR/css-display/#transformations
ā€œSome layout eļ¬€ects
requireĀ blockiļ¬cationĀ orĀ inliniļ¬cationĀ of the box
type, which sets the boxā€™sĀ outer display type, if it
is notĀ noneĀ orĀ contents,
toĀ blockĀ orĀ inlineĀ (respectively).ā€
<div class="grid">
<a href="">one</a>
<span>two</span>
<div>three</div>
<img src="img.png" alt="placeholder">
</div>
.grid {
display: grid;
grid-template-columns: repeat(4,200px);
grid-gap: 8px;
height: 200px;
border: 8px solid rgb(3,99,143);
}
Why is knowing this useful?
.wrapper {
max-width: 800px;
border-spacing: 20px;
}
.image {
display: table-cell;
}
.content {
display: table-cell;
vertical-align: top;
}
https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes
ā€œAny table element will automatically generate
necessary anonymous table objects around itself,
consisting of at least three nested objects
corresponding to a 'table'/'inline-table' element, a
'table-row' element, and a 'table-cell' element.ā€
CSS Grid: https://www.w3.org/TR/css-grid-1/#grid-item-display
ā€œNote:Ā Some values ofĀ displayĀ normally trigger the
creation of anonymous boxes around the original
box. If such a box is aĀ grid item, it is blockiļ¬ed ļ¬rst,
and so anonymous box creation will not happen.
For example, two contiguousĀ grid
itemsĀ withĀ display: table-cellĀ will become two
separateĀ display: blockĀ grid items, instead of being
wrapped into a single anonymous table.ā€
.wrapper {
max-width: 800px;
border-spacing: 20px;
display: grid;
grid-template-columns: auto 1fr;
grid-gap: 20px;
}
.image {
display: table-cell;
}
.content {
display: table-cell;
vertical-align: top;
}
https://codepen.io/rachelandrew/pen/KqMyzN
.grid {
max-width: 800px;
border-spacing: 20px;
display: grid;
grid-template-columns: auto 1fr;
grid-gap: 20px;
}
@supports (grid-gap: 20px) {
.grid {
margin: 20px;
}
}
.image {
display: table-cell;
}
.content {
display: table-cell;
vertical-align: top;
}
https://codepen.io/rachelandrew/pen/qjNVwG
Creating fallbacks
ā–ø You do not need to write two sets of code
ā–ø Write your fallback code and then write your grid code
ā–ø In many cases the spec has you covered
ā–ø Use Feature Queries to isolate things that would apply to both grid-supporting
and non-supporting browsers
https://rachelandrew.co.uk/css/cheatsheets/grid-fallbacks
What happened to subgrid?
.grid {
display: grid;
max-width: 960px;
margin: 0 auto;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
}
CSS Grid
Creating a three column layout with
CSS Grid.
https://codepen.io/rachelandrew/pen/XgdydE
.card {
display: flex;
flex-direction: column;
}
.card .inner {
flex: 1;
}
Make the card a ļ¬‚ex item
Allow the inner to grow, it pushes the
footer down to the bottom of the
card.s
https://codepen.io/rachelandrew/pen/XgdydE
1
2
3
4
5
.card {
border: 4px solid rgb(24,154,153);
background-color: #fff;
grid-row: auto / span 4;
display: subgrid;
}
display: subgrid
The card is a direct child of the grid
so needs to span four rows of the grid
to make room for the four rows in the
subgridded internals.ā€Ø
ā€Ø
display: subgrid means the card now
uses the tracks of the parent grid.
Subgrid links and thoughts
ā–ø https://rachelandrew.co.uk/archives/2017/03/16/subgrid-moved-to-level-2-
of-the-css-grid-speciļ¬cation/
ā–ø https://github.com/w3c/csswg-drafts/issues/958
ā–ø https://github.com/rachelandrew/cssgrid-ama/issues/13
ā–ø http://meyerweb.com/eric/thoughts/2016/01/15/subgrids-considered-
essential/
Vanishing boxes with display:contents
display: contents https://drafts.csswg.org/css-display/#box-generation
ā€œThe element itself does not generate any boxes,
but its children and pseudo-elements still
generate boxes as normal. For the purposes of
box generation and layout, the element must be
treated as if it had been replaced in theĀ element
treeĀ by its contentsā€
<div class="flex">
<div>One</div>
<div>Two</div>
<div class="nested">
<div>Nested One</div>
<div>Nested Two</div>
</div>
</div>
<div class="grid">
<div>One</div>
<div>Two</div>
<div class="nested">
<div>Nested One</div>
<div>Nested Two</div>
</div>
</div>
https://codepen.io/rachelandrew/pen/GEZPex
.flex {
display: flex;
border: 8px solid rgb(3,99,143);
}
.flex > * {
flex: 1;
border: 8px solid rgb(24,154,153);
}
.grid {
display: grid;
border: 8px solid rgb(3,99,143);
grid-template-columns:
repeat(4,minmax(200px, 1fr));
grid-gap: 8px;
}
.grid > * {
border: 8px solid rgb(24,154,153);
}
https://codepen.io/rachelandrew/pen/GEZPex
.nested {
display: contents;
}
https://codepen.io/rachelandrew/pen/GEZPex
Needs Firefox or Chrome Canary
.flex > * {
flex: 1;
border: 8px solid rgb(24,154,153);
}
.grid > * {
border: 8px solid rgb(24,154,153);
}
.card {
border: 4px solid rgb(24,154,153);
background-color: #fff;
display: contents;
}
display: contents
We add this to the direct child of the
grid container.
https://codepen.io/rachelandrew/pen/QgNJYa
1
2
3
4
5
.card {
border: 4px solid rgb(24,154,153);
background-color: #fff;
grid-row: auto / span 4;
display: contents;
}
Make room for the rows
Each card needs four rows.
.card:nth-child(1) h2{ grid-column: 1; grid-row: 1; }
.card:nth-child(1) img{ grid-column: 1; grid-row: 2; }
.card:nth-child(1) .inner{ grid-column: 1; grid-row: 3; }
.card:nth-child(1) footer{ grid-column: 1; grid-row: 4; }
.card:nth-child(2) h2{ grid-column: 2; grid-row: 1; }
.card:nth-child(2) img{ grid-column: 2; grid-row: 2; }
.card:nth-child(2) .inner{ grid-column: 2; grid-row: 3; }
.card:nth-child(2) footer{ grid-column: 2; grid-row: 4; }
.card:nth-child(3) h2{ grid-column: 3; grid-row: 1; }
.card:nth-child(3) img{ grid-column: 3; grid-row: 2; }
.card:nth-child(3) .inner{ grid-column: 3; grid-row: 3; }
.card:nth-child(3) footer{ grid-column: 3; grid-row: 4; }
.card:nth-child(4) h2{ grid-column: 1; grid-row: 5; }
.card:nth-child(4) img{ grid-column: 1; grid-row: 6; }
.card:nth-child(4) .inner{ grid-column: 1; grid-row: 7;}
.card:nth-child(4) footer{ grid-column: 1; grid-row: 8; }
.card:nth-child(5) h2{ grid-column: 2; grid-row: 5; }
.card:nth-child(5) img{ grid-column: 2; grid-row: 6; }
.card:nth-child(5) .inner{ grid-column: 2; grid-row: 7; }
.card:nth-child(5) footer{ grid-column: 2; grid-row: 8; }
.card:nth-child(6) h2{ grid-column: 3; grid-row: 5; }
.card:nth-child(6) img{ grid-column: 3; grid-row: 6; }
.card:nth-child(6) .inner{ grid-column: 3; grid-row: 7; }
.card:nth-child(6) footer{ grid-column: 3; grid-row: 8; }
Ugh.
Donā€™t do this.
https://codepen.io/rachelandrew/pen/QgNJYa
display: contents
ā–ø Use when the element you are removing has no box styling (e.g. backgrounds
and borders) attached
ā–ø Current browser support Firefox, Chrome Canary
It is all logical.
/* this shorthand */
.a {
grid-area: 1 / 2 / 2 / 5;
}
/* is the same as this */
.a {
grid-row-start: 1;
grid-column-start: 2;
grid-row-end: 2;
grid-column-end: 5;
}
The order of values in grid-area
ā€¢row-start
ā€¢column-start
ā€¢row-end
ā€¢column-end
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(4, 150px);
grid-template-rows: repeat(3, 100px);
}
.a {
grid-area: 1 / 2 / 2 / 5;
}
.b {
grid-area: 1 / 1 / 3 / 4;
}
https://codepen.io/rachelandrew/pen/BZKbaN
.grid {
Direction: rtl;
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(4, 150px);
grid-template-rows: repeat(3, 100px);
}
.a {
grid-area: 1 / 2 / 2 / 5;
}
.b {
grid-area: 1 / 1 / 3 / 4;
}
https://codepen.io/rachelandrew/pen/BZKbaN
CSS Logical Properties
ā€œThis module introduces logical properties and
values that provide the author with the ability to
control layout through logical, rather than physical,
direction and dimension mappings. The module
deļ¬nes logical properties and values for the
features deļ¬ned inĀ CSS2.1. These properties are
writing-mode relative equivalents of their
corresponding physical properties.ā€
Logical not Physical
ā–ø The start of a page rather than the top
ā–ø The end of a block rather than the right
ā–ø In grid layout we have start and end for both columns and rows, rather than
referring to the top and bottom of columns and left and right of rows
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(3,
150px);
grid-template-rows: repeat(3, 100px);
justify-content: end;
align-content: end;
}
https://codepen.io/rachelandrew/pen/pwyBpG
End
End
Start
Start
direction: ltr
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(3,
150px);
grid-template-rows: repeat(3, 100px);
justify-content: end;
align-content: end;
}
https://codepen.io/rachelandrew/pen/pwyBpG
End
End
Start
Start
direction: rtl
https://rachelandrew.co.uk/css/cheatsheets/box-alignment
Whatā€™s in a name?
https://cloudfour.com/thinks/breaking-out-with-css-grid-layout/
.Prose {
display: grid;
grid-template-columns:
[full-start] minmax(1em, 1fr)
[main-start] minmax(0, 40em) [main-end]
minmax(1em, 1fr) [full-end];
}
.Prose > * {
grid-column: main;
}
.Prose-splash {
grid-column: full;
}
Just do this!
Magic occurs.
<div class="grid">
<div>Content</div>
<div class="gallery">Full width
content</div>
<div>Content</div>
</div>
My markup
A div containing three direct child
elements, one with a class of ā€˜galleryā€™.
Thatā€™s our full width content.
.grid {
display: grid;
grid-template-columns:
minmax(1em, 1fr)
minmax(0, 660px)
minmax(1em, 1fr);
}
.grid > * {
grid-column: 2 ;
}
.grid > .gallery {
grid-column: 1 / -1 ;
}
A grid with 3 column tracks
Using the line numbers to place our
content and full width items.
https://codepen.io/rachelandrew/pen/mwOmJW
1 2 3 4
1 2 3 4
grid-column: 2;
grid-column: 1 / 4;
grid-column: 2;
.grid {
display: grid;
grid-template-columns:
[full-start] minmax(1em, 1fr)
[main-start] minmax(0, 660px)
[main-end] minmax(1em, 1fr)
[full-end];
}
.grid > * {
grid-column: main-start;
}
.grid > .gallery {
grid-column: full-start / full-end;
}
Naming lines on the grid
We can now position the items using
their line names.
https://codepen.io/rachelandrew/pen/EXjrJM
full-start main-start main-end full-end
grid-column: main-start;
grid-column: full-start / full-end;
full-start main-start main-end full-end
grid-column: main-start;
grid-column: main;
grid-column: full;
full-start main-start main-end full-end
grid-column: main;
.grid {
display: grid;
max-width: 960px;
margin: 0 auto;
grid-template-columns: [full-start]
minmax(1em, 1fr)
[main-start] minmax(0, 660px) [main-end]
minmax(1em, 1fr) [full-end];
}
.grid > * {
grid-column: main;
}
.grid > .gallery {
grid-column: full;
}
ā€˜mainā€™ and ā€˜fullā€™
These line names donā€™t exist
anywhere in our grid deļ¬nition.
https://www.w3.org/TR/css-grid-1/#implicit-named-areas
ā€œSince a named grid area is referenced by the
implicit named lines it produces, explicitly adding
named lines of the same form (foo-start/foo-end)
eļ¬€ectively creates a named grid area. ā€
main-start
main-start
main-end
main-end
main
.grid {
display: grid;
grid-gap: 20px;
grid-template-columns:
100px [main-start]
100px 100px 100px [main-end]
100px 100px;
grid-template-rows:
100px [main-start]
100px 100px [main-end] 100px;
}
.item {
grid-area: main;
}
Implicit named areas
Created by having named lines using
an ident with *-start and *-end.
https://codepen.io/rachelandrew/pen/EXNmvj
.grid {
display: grid;
grid-template-columns: [full-start]
minmax(1em, 1fr)
[main-start] minmax(0, 660px) [main-
end]
minmax(1em, 1fr) [full-end];
grid-template-rows: auto auto [full-
start] auto [full-end];
}
.grid > * {
grid-column: main-start;
}
.grid > .gallery {
grid-area: full;
}
Magic named area
We have deļ¬ned lines named full-
start and full-end for rows and
columns so we have an area named
full.
https://codepen.io/rachelandrew/pen/jwPjWK
https://www.w3.org/TR/css-grid-1/#line-placement
ā€œNote: Named grid areas automatically generate
implicit named lines of this form, so specifying
grid-row-start: foo will choose the start edge of
that named grid area (unless another line named
foo-start was explicitly speciļ¬ed before it).ā€
Named lines create a named area
which in turn can be used as
named lines.
https://www.w3.org/TR/css-grid-1/#placement-shorthands
ā€œ[when using grid-row and grid-column
shorthands] ā€¦ When the second value is omitted,
if the ļ¬rst value is a <custom-ident>, the grid-row-
end/grid-column-end longhand is also set to
that <custom-ident>; otherwise, it is set to auto.ā€
grid-column: main;
grid-column: full;
full-start main-start main-end full-end
grid-column: main;
grid-column: main / main;
grid-column: full / full;
full-start main-start main-end full-end
grid-column: main / main;
full fullmain main
.grid {
display: grid;
max-width: 960px;
margin: 0 auto;
grid-template-columns: [full-start]
minmax(1em, 1fr)
[main-start] minmax(0, 660px) [main-end]
minmax(1em, 1fr) [full-end];
}
.grid > * {
grid-column: main;
}
.grid > .gallery {
grid-column: full;
}
Targeting the column track
The line name ā€˜mainā€™ is created from
the named area created by our
named lines.
https://codepen.io/rachelandrew/pen/owXKMd
.grid {
display: grid;
grid-template-columns: [full-start panel1-start]
1fr 1fr [content-start] 1fr 1fr 1fr 1fr [panel1-
end panel2-start ] 1fr 1fr 1fr 1fr [content-end]
1fr 1fr [panel2-end full-end] ;
}
.grid > * {
grid-column: content;
}
.grid > .gallery {
grid-column: full;
}
.grid > .panel1 {
grid-column: panel1;
padding: 4px;
}
.grid > .panel2 {
grid-column: panel2;
padding: 4px;
}
Extending the example
Adding named areas panel1 and
panel2.
https://codepen.io/rachelandrew/pen/YQXmJJ/
.grid {
display: grid;
grid-template-columns: minmax(1em,
1fr) minmax(0, 660px) minmax(1em, 1fr);
grid-template-areas:
". title ."
". content-top ."
"full-width full-width full-width"
". content-bottom ."
}
h1 { grid-area: title; }
.content1 { grid-area: content-top; }
.content2 { grid-area: content-bottom; }
.gallery { grid-area: full-width; }
Magic Grid Lines
If you have a named area you get grid
lines named *-start and *-end for rows
and columns.
https://codepen.io/rachelandrew/pen/qjdzwR
.grid {
display: grid;
grid-template-columns: minmax(1em,
1fr) minmax(0, 660px) minmax(1em, 1fr);
grid-template-areas:
". title ."
". content-top ."
"full-width full-width full-width"
". content-bottom ."
}
h1 { grid-area: title; }
.content1 { grid-area: content-top; }
.content2 { grid-area: content-bottom; }
.gallery { grid-area: full-width; }
Magic Grid Lines
Each grid-area creates a set of lines
for the start and end of the area -
rows and columns.
For title, we have title-start and title-
end for rows and columns.
https://codepen.io/rachelandrew/pen/qjdzwR
.grid::after {
content: "";
background-color: #fff;
border: 4px solid rgb(182,222,211);
grid-column:
content-top-start / content-top-end;
grid-row:
title-start / content-bottom-end;
z-index: -1;
}
Magic Lines
Positioning some generated content
using the magical lines.
https://codepen.io/rachelandrew/pen/qjdzwR
Things appearing ā€Ø
in unexpected places.
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: 100px [main-start]
100px 100px [main-end];
}
.a {
grid-column: 1 / 3;
grid-row: 1;
}
.b {
grid-column: 3;
grid-row: 1 / 3;
}
.c {
grid-column: 1;
}
.d {
grid-column: 2;
grid-row: 2;
}
https://codepen.io/rachelandrew/pen/JJYxve/
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: 100px [main-
start] 100px 100px [main-end];
}
.e {
grid-area: main;
}
https://codepen.io/rachelandrew/pen/JJYxve/
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: 100px [main-
start] 100px 100px [main-end];
}
.e {
grid-area: auto/ main;
}
https://codepen.io/rachelandrew/pen/JJYxve/
So many possibilities.
Find out more
I made you some resources
Visit Grid by Example for worked examples, patterns with
fallbacks, and a free video tutorial:ā€Ø
gridbyexample.com
I created a huge set of guides for MDN: ā€Ø
https://developer.mozilla.org/en-US/docs/Web/CSS/
CSS_Grid_Layout
Over 4 years of grid thoughts on my site at:ā€Ø
https://rachelandrew.co.uk/archives/tag/cssgrid
CSS Grid AMA:ā€Ø
https://github.com/rachelandrew/cssgrid-ama ā€Ø
THANK YOU!
@rachelandrewā€Ø
ā€Ø
Resources & code: https://rachelandrew.co.uk/speaking/event/cssday-nl-2017

More Related Content

What's hot

Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid LayoutRachel Andrew
Ā 
CSS Grid for html5j
CSS Grid for html5jCSS Grid for html5j
CSS Grid for html5jRachel Andrew
Ā 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout Rachel Andrew
Ā 
Laracon Online: Grid and Flexbox
Laracon Online: Grid and FlexboxLaracon Online: Grid and Flexbox
Laracon Online: Grid and FlexboxRachel Andrew
Ā 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid LayoutRachel Andrew
Ā 
CSSConf.asia - Laying out the future
CSSConf.asia - Laying out the futureCSSConf.asia - Laying out the future
CSSConf.asia - Laying out the futureRachel Andrew
Ā 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid LayoutRachel Andrew
Ā 
CSS Grid Layout: An Event Apart Boston 2016
CSS Grid Layout: An Event Apart Boston 2016CSS Grid Layout: An Event Apart Boston 2016
CSS Grid Layout: An Event Apart Boston 2016Rachel Andrew
Ā 
Solving Layout Problems with CSS Grid & Friends - WEBU17
Solving Layout Problems with CSS Grid & Friends - WEBU17Solving Layout Problems with CSS Grid & Friends - WEBU17
Solving Layout Problems with CSS Grid & Friends - WEBU17Rachel Andrew
Ā 
New CSS Meets the Real World
New CSS Meets the Real WorldNew CSS Meets the Real World
New CSS Meets the Real WorldRachel Andrew
Ā 
Confoo: You can use CSS for that!
Confoo: You can use CSS for that!Confoo: You can use CSS for that!
Confoo: You can use CSS for that!Rachel Andrew
Ā 
The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSSRachel Andrew
Ā 
Next-level CSS
Next-level CSSNext-level CSS
Next-level CSSRachel Andrew
Ā 
Confoo: The New CSS Layout
Confoo: The New CSS LayoutConfoo: The New CSS Layout
Confoo: The New CSS LayoutRachel Andrew
Ā 
CSS Grid Layout for Frontend NE
CSS Grid Layout for Frontend NECSS Grid Layout for Frontend NE
CSS Grid Layout for Frontend NERachel Andrew
Ā 
Future Layout & Performance
Future Layout & PerformanceFuture Layout & Performance
Future Layout & PerformanceRachel Andrew
Ā 
Laying out the future
Laying out the futureLaying out the future
Laying out the futureRachel Andrew
Ā 
Making the most of New CSS Layout
Making the most of New CSS LayoutMaking the most of New CSS Layout
Making the most of New CSS LayoutRachel Andrew
Ā 
Introduction to CSS Grid Layout
Introduction to CSS Grid LayoutIntroduction to CSS Grid Layout
Introduction to CSS Grid LayoutRachel Andrew
Ā 

What's hot (20)

Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid Layout
Ā 
CSS Grid for html5j
CSS Grid for html5jCSS Grid for html5j
CSS Grid for html5j
Ā 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
Ā 
Laracon Online: Grid and Flexbox
Laracon Online: Grid and FlexboxLaracon Online: Grid and Flexbox
Laracon Online: Grid and Flexbox
Ā 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid Layout
Ā 
CSSConf.asia - Laying out the future
CSSConf.asia - Laying out the futureCSSConf.asia - Laying out the future
CSSConf.asia - Laying out the future
Ā 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
Ā 
CSS Grid Layout: An Event Apart Boston 2016
CSS Grid Layout: An Event Apart Boston 2016CSS Grid Layout: An Event Apart Boston 2016
CSS Grid Layout: An Event Apart Boston 2016
Ā 
Solving Layout Problems with CSS Grid & Friends - WEBU17
Solving Layout Problems with CSS Grid & Friends - WEBU17Solving Layout Problems with CSS Grid & Friends - WEBU17
Solving Layout Problems with CSS Grid & Friends - WEBU17
Ā 
New CSS Meets the Real World
New CSS Meets the Real WorldNew CSS Meets the Real World
New CSS Meets the Real World
Ā 
Confoo: You can use CSS for that!
Confoo: You can use CSS for that!Confoo: You can use CSS for that!
Confoo: You can use CSS for that!
Ā 
The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSS
Ā 
Next-level CSS
Next-level CSSNext-level CSS
Next-level CSS
Ā 
Confoo: The New CSS Layout
Confoo: The New CSS LayoutConfoo: The New CSS Layout
Confoo: The New CSS Layout
Ā 
CSS Grid Layout for Frontend NE
CSS Grid Layout for Frontend NECSS Grid Layout for Frontend NE
CSS Grid Layout for Frontend NE
Ā 
Future Layout & Performance
Future Layout & PerformanceFuture Layout & Performance
Future Layout & Performance
Ā 
CSS Grid
CSS GridCSS Grid
CSS Grid
Ā 
Laying out the future
Laying out the futureLaying out the future
Laying out the future
Ā 
Making the most of New CSS Layout
Making the most of New CSS LayoutMaking the most of New CSS Layout
Making the most of New CSS Layout
Ā 
Introduction to CSS Grid Layout
Introduction to CSS Grid LayoutIntroduction to CSS Grid Layout
Introduction to CSS Grid Layout
Ā 

Similar to Discover How to Layout with CSS Grid

Google Developers Experts Summit 2017 - CSS Layout
Google Developers Experts Summit 2017 - CSS Layout Google Developers Experts Summit 2017 - CSS Layout
Google Developers Experts Summit 2017 - CSS Layout Rachel Andrew
Ā 
Solving Layout Problems with CSS Grid & Friends - NordicJS
Solving Layout Problems with CSS Grid & Friends - NordicJSSolving Layout Problems with CSS Grid & Friends - NordicJS
Solving Layout Problems with CSS Grid & Friends - NordicJSRachel Andrew
Ā 
Start Using CSS Grid Layout Today - RuhrJS
Start Using CSS Grid Layout Today - RuhrJSStart Using CSS Grid Layout Today - RuhrJS
Start Using CSS Grid Layout Today - RuhrJSRachel Andrew
Ā 
404.ie: Solving Layout Problems with CSS Grid & Friends
404.ie: Solving Layout Problems with CSS Grid & Friends404.ie: Solving Layout Problems with CSS Grid & Friends
404.ie: Solving Layout Problems with CSS Grid & FriendsRachel Andrew
Ā 
Solving Layout Problems With CSS Grid and Friends
Solving Layout Problems With CSS Grid and FriendsSolving Layout Problems With CSS Grid and Friends
Solving Layout Problems With CSS Grid and FriendsFITC
Ā 
Solving Layout Problems with CSS Grid & Friends - DevFest17
Solving Layout Problems with CSS Grid & Friends - DevFest17Solving Layout Problems with CSS Grid & Friends - DevFest17
Solving Layout Problems with CSS Grid & Friends - DevFest17Rachel Andrew
Ā 
View Source London: Solving Layout Problems with CSS Grid & Friends
View Source London: Solving Layout Problems with CSS Grid & FriendsView Source London: Solving Layout Problems with CSS Grid & Friends
View Source London: Solving Layout Problems with CSS Grid & FriendsRachel Andrew
Ā 
World of CSS Grid
World of CSS GridWorld of CSS Grid
World of CSS GridElad Shechter
Ā 
An Event Apart Nashville: CSS Grid Layout
An Event Apart Nashville: CSS Grid LayoutAn Event Apart Nashville: CSS Grid Layout
An Event Apart Nashville: CSS Grid LayoutRachel Andrew
Ā 
DevFest Nantes - Start Using CSS Grid Layout today
DevFest Nantes - Start Using CSS Grid Layout todayDevFest Nantes - Start Using CSS Grid Layout today
DevFest Nantes - Start Using CSS Grid Layout todayRachel Andrew
Ā 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSSRachel Andrew
Ā 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid LayoutRachel Andrew
Ā 
An Event Apart SF: CSS Grid Layout
An Event Apart SF: CSS Grid LayoutAn Event Apart SF: CSS Grid Layout
An Event Apart SF: CSS Grid LayoutRachel Andrew
Ā 
Into the Weeds of CSS Layout
Into the Weeds of CSS LayoutInto the Weeds of CSS Layout
Into the Weeds of CSS LayoutRachel Andrew
Ā 
Devoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid LayoutDevoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid LayoutRachel Andrew
Ā 
CSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzCSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzRachel Andrew
Ā 
The Future of Frontend - what is new in CSS?
The Future of Frontend - what is new in CSS?The Future of Frontend - what is new in CSS?
The Future of Frontend - what is new in CSS?Rachel Andrew
Ā 
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...Igalia
Ā 
CSS Grid layout - De volta para o futuro
CSS Grid layout - De volta para o futuroCSS Grid layout - De volta para o futuro
CSS Grid layout - De volta para o futuroAfonso Pacifer
Ā 
Laying out the future with grid & flexbox - Smashing Conf Freiburg
Laying out the future with grid & flexbox - Smashing Conf FreiburgLaying out the future with grid & flexbox - Smashing Conf Freiburg
Laying out the future with grid & flexbox - Smashing Conf FreiburgRachel Andrew
Ā 

Similar to Discover How to Layout with CSS Grid (20)

Google Developers Experts Summit 2017 - CSS Layout
Google Developers Experts Summit 2017 - CSS Layout Google Developers Experts Summit 2017 - CSS Layout
Google Developers Experts Summit 2017 - CSS Layout
Ā 
Solving Layout Problems with CSS Grid & Friends - NordicJS
Solving Layout Problems with CSS Grid & Friends - NordicJSSolving Layout Problems with CSS Grid & Friends - NordicJS
Solving Layout Problems with CSS Grid & Friends - NordicJS
Ā 
Start Using CSS Grid Layout Today - RuhrJS
Start Using CSS Grid Layout Today - RuhrJSStart Using CSS Grid Layout Today - RuhrJS
Start Using CSS Grid Layout Today - RuhrJS
Ā 
404.ie: Solving Layout Problems with CSS Grid & Friends
404.ie: Solving Layout Problems with CSS Grid & Friends404.ie: Solving Layout Problems with CSS Grid & Friends
404.ie: Solving Layout Problems with CSS Grid & Friends
Ā 
Solving Layout Problems With CSS Grid and Friends
Solving Layout Problems With CSS Grid and FriendsSolving Layout Problems With CSS Grid and Friends
Solving Layout Problems With CSS Grid and Friends
Ā 
Solving Layout Problems with CSS Grid & Friends - DevFest17
Solving Layout Problems with CSS Grid & Friends - DevFest17Solving Layout Problems with CSS Grid & Friends - DevFest17
Solving Layout Problems with CSS Grid & Friends - DevFest17
Ā 
View Source London: Solving Layout Problems with CSS Grid & Friends
View Source London: Solving Layout Problems with CSS Grid & FriendsView Source London: Solving Layout Problems with CSS Grid & Friends
View Source London: Solving Layout Problems with CSS Grid & Friends
Ā 
World of CSS Grid
World of CSS GridWorld of CSS Grid
World of CSS Grid
Ā 
An Event Apart Nashville: CSS Grid Layout
An Event Apart Nashville: CSS Grid LayoutAn Event Apart Nashville: CSS Grid Layout
An Event Apart Nashville: CSS Grid Layout
Ā 
DevFest Nantes - Start Using CSS Grid Layout today
DevFest Nantes - Start Using CSS Grid Layout todayDevFest Nantes - Start Using CSS Grid Layout today
DevFest Nantes - Start Using CSS Grid Layout today
Ā 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSS
Ā 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid Layout
Ā 
An Event Apart SF: CSS Grid Layout
An Event Apart SF: CSS Grid LayoutAn Event Apart SF: CSS Grid Layout
An Event Apart SF: CSS Grid Layout
Ā 
Into the Weeds of CSS Layout
Into the Weeds of CSS LayoutInto the Weeds of CSS Layout
Into the Weeds of CSS Layout
Ā 
Devoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid LayoutDevoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid Layout
Ā 
CSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzCSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, Linz
Ā 
The Future of Frontend - what is new in CSS?
The Future of Frontend - what is new in CSS?The Future of Frontend - what is new in CSS?
The Future of Frontend - what is new in CSS?
Ā 
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
Ā 
CSS Grid layout - De volta para o futuro
CSS Grid layout - De volta para o futuroCSS Grid layout - De volta para o futuro
CSS Grid layout - De volta para o futuro
Ā 
Laying out the future with grid & flexbox - Smashing Conf Freiburg
Laying out the future with grid & flexbox - Smashing Conf FreiburgLaying out the future with grid & flexbox - Smashing Conf Freiburg
Laying out the future with grid & flexbox - Smashing Conf Freiburg
Ā 

More from Rachel Andrew

All Day Hey! Unlocking The Power of CSS Grid Layout
All Day Hey! Unlocking The Power of CSS Grid LayoutAll Day Hey! Unlocking The Power of CSS Grid Layout
All Day Hey! Unlocking The Power of CSS Grid LayoutRachel Andrew
Ā 
SmashingConf SF: Unlocking the Power of CSS Grid Layout
SmashingConf SF: Unlocking the Power of CSS Grid LayoutSmashingConf SF: Unlocking the Power of CSS Grid Layout
SmashingConf SF: Unlocking the Power of CSS Grid LayoutRachel Andrew
Ā 
Unlocking the Power of CSS Grid Layout
Unlocking the Power of CSS Grid LayoutUnlocking the Power of CSS Grid Layout
Unlocking the Power of CSS Grid LayoutRachel Andrew
Ā 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSSRachel Andrew
Ā 
Graduating to Grid
Graduating to GridGraduating to Grid
Graduating to GridRachel Andrew
Ā 
Web Summer Camp Keynote
Web Summer Camp KeynoteWeb Summer Camp Keynote
Web Summer Camp KeynoteRachel Andrew
Ā 
New CSS Layout Meets the Real World
New CSS Layout Meets the Real WorldNew CSS Layout Meets the Real World
New CSS Layout Meets the Real WorldRachel Andrew
Ā 
An Event Apart DC - New CSS Layout meets the Real World
An Event Apart DC - New CSS Layout meets the Real WorldAn Event Apart DC - New CSS Layout meets the Real World
An Event Apart DC - New CSS Layout meets the Real WorldRachel Andrew
Ā 
Perch, Patterns and Old Browsers
Perch, Patterns and Old BrowsersPerch, Patterns and Old Browsers
Perch, Patterns and Old BrowsersRachel Andrew
Ā 
Where does CSS come from?
Where does CSS come from?Where does CSS come from?
Where does CSS come from?Rachel Andrew
Ā 

More from Rachel Andrew (10)

All Day Hey! Unlocking The Power of CSS Grid Layout
All Day Hey! Unlocking The Power of CSS Grid LayoutAll Day Hey! Unlocking The Power of CSS Grid Layout
All Day Hey! Unlocking The Power of CSS Grid Layout
Ā 
SmashingConf SF: Unlocking the Power of CSS Grid Layout
SmashingConf SF: Unlocking the Power of CSS Grid LayoutSmashingConf SF: Unlocking the Power of CSS Grid Layout
SmashingConf SF: Unlocking the Power of CSS Grid Layout
Ā 
Unlocking the Power of CSS Grid Layout
Unlocking the Power of CSS Grid LayoutUnlocking the Power of CSS Grid Layout
Unlocking the Power of CSS Grid Layout
Ā 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSS
Ā 
Graduating to Grid
Graduating to GridGraduating to Grid
Graduating to Grid
Ā 
Web Summer Camp Keynote
Web Summer Camp KeynoteWeb Summer Camp Keynote
Web Summer Camp Keynote
Ā 
New CSS Layout Meets the Real World
New CSS Layout Meets the Real WorldNew CSS Layout Meets the Real World
New CSS Layout Meets the Real World
Ā 
An Event Apart DC - New CSS Layout meets the Real World
An Event Apart DC - New CSS Layout meets the Real WorldAn Event Apart DC - New CSS Layout meets the Real World
An Event Apart DC - New CSS Layout meets the Real World
Ā 
Perch, Patterns and Old Browsers
Perch, Patterns and Old BrowsersPerch, Patterns and Old Browsers
Perch, Patterns and Old Browsers
Ā 
Where does CSS come from?
Where does CSS come from?Where does CSS come from?
Where does CSS come from?
Ā 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
Ā 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
Ā 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
Ā 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
Ā 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
Ā 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜RTylerCroy
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĆŗjo
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
Ā 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
Ā 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhisoniya singh
Ā 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
Ā 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Ā 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Ā 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Ā 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Ā 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Ā 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Ā 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Ā 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
Ā 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Ā 

Discover How to Layout with CSS Grid

  • 1. WHAT I DISCOVERED ABOUT LAYOUT VIA CSS GRID @rachelandrew #cssday
  • 2.
  • 3. March 2017 March 2017 March 2017 March 2017 March 2017 Soooooon!
  • 5. Itā€™s not CSS Vaporware!*ā€Ø ā€Ø ā€Ø *Iā€™m very happy about this
  • 6. The more I know about CSS, the more I realise I donā€™t know.
  • 7. CSS Grid and friends ā–ø CSS Display ā–ø Writing Modes ā–ø Logical Properties ā–ø Box Alignment ā–ø Feature Queries
  • 8. CSS Display: https://drafts.csswg.org/css-display/ ā€œThis module describes how the CSS formatting box tree is generated from the document element tree and deļ¬nes theĀ displayĀ property that controls it.ā€
  • 9. CSS Display: https://drafts.csswg.org/css-display/ ā–ø The Outer Display Type - how does this box behave in relationship to its parent? ā–ø The Inner Display Type - what formatting context does it create for its child elements?
  • 10. CSS Grid: https://www.w3.org/TR/css-grid-1/#grid-item-display ā€œTheĀ displayĀ value of aĀ grid itemĀ isĀ blockiļ¬ed: if the speciļ¬edĀ displayĀ of an in-ļ¬‚ow child of an element generating aĀ grid container is an inline- level value, it computes to its block-level equivalent.Ā ā€
  • 11. CSS Display: https://www.w3.org/TR/css-display/#transformations ā€œSome layout eļ¬€ects requireĀ blockiļ¬cationĀ orĀ inliniļ¬cationĀ of the box type, which sets the boxā€™sĀ outer display type, if it is notĀ noneĀ orĀ contents, toĀ blockĀ orĀ inlineĀ (respectively).ā€
  • 13. .grid { display: grid; grid-template-columns: repeat(4,200px); grid-gap: 8px; height: 200px; border: 8px solid rgb(3,99,143); }
  • 14. Why is knowing this useful?
  • 15. .wrapper { max-width: 800px; border-spacing: 20px; } .image { display: table-cell; } .content { display: table-cell; vertical-align: top; }
  • 16. https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes ā€œAny table element will automatically generate necessary anonymous table objects around itself, consisting of at least three nested objects corresponding to a 'table'/'inline-table' element, a 'table-row' element, and a 'table-cell' element.ā€
  • 17. CSS Grid: https://www.w3.org/TR/css-grid-1/#grid-item-display ā€œNote:Ā Some values ofĀ displayĀ normally trigger the creation of anonymous boxes around the original box. If such a box is aĀ grid item, it is blockiļ¬ed ļ¬rst, and so anonymous box creation will not happen. For example, two contiguousĀ grid itemsĀ withĀ display: table-cellĀ will become two separateĀ display: blockĀ grid items, instead of being wrapped into a single anonymous table.ā€
  • 18. .wrapper { max-width: 800px; border-spacing: 20px; display: grid; grid-template-columns: auto 1fr; grid-gap: 20px; } .image { display: table-cell; } .content { display: table-cell; vertical-align: top; } https://codepen.io/rachelandrew/pen/KqMyzN
  • 19. .grid { max-width: 800px; border-spacing: 20px; display: grid; grid-template-columns: auto 1fr; grid-gap: 20px; } @supports (grid-gap: 20px) { .grid { margin: 20px; } } .image { display: table-cell; } .content { display: table-cell; vertical-align: top; } https://codepen.io/rachelandrew/pen/qjNVwG
  • 20. Creating fallbacks ā–ø You do not need to write two sets of code ā–ø Write your fallback code and then write your grid code ā–ø In many cases the spec has you covered ā–ø Use Feature Queries to isolate things that would apply to both grid-supporting and non-supporting browsers
  • 22. What happened to subgrid?
  • 23.
  • 24. .grid { display: grid; max-width: 960px; margin: 0 auto; grid-template-columns: repeat(3, 1fr); grid-gap: 20px; } CSS Grid Creating a three column layout with CSS Grid. https://codepen.io/rachelandrew/pen/XgdydE
  • 25.
  • 26. .card { display: flex; flex-direction: column; } .card .inner { flex: 1; } Make the card a ļ¬‚ex item Allow the inner to grow, it pushes the footer down to the bottom of the card.s https://codepen.io/rachelandrew/pen/XgdydE
  • 27.
  • 29. .card { border: 4px solid rgb(24,154,153); background-color: #fff; grid-row: auto / span 4; display: subgrid; } display: subgrid The card is a direct child of the grid so needs to span four rows of the grid to make room for the four rows in the subgridded internals.ā€Ø ā€Ø display: subgrid means the card now uses the tracks of the parent grid.
  • 30.
  • 31. Subgrid links and thoughts ā–ø https://rachelandrew.co.uk/archives/2017/03/16/subgrid-moved-to-level-2- of-the-css-grid-speciļ¬cation/ ā–ø https://github.com/w3c/csswg-drafts/issues/958 ā–ø https://github.com/rachelandrew/cssgrid-ama/issues/13 ā–ø http://meyerweb.com/eric/thoughts/2016/01/15/subgrids-considered- essential/
  • 32. Vanishing boxes with display:contents
  • 33. display: contents https://drafts.csswg.org/css-display/#box-generation ā€œThe element itself does not generate any boxes, but its children and pseudo-elements still generate boxes as normal. For the purposes of box generation and layout, the element must be treated as if it had been replaced in theĀ element treeĀ by its contentsā€
  • 34. <div class="flex"> <div>One</div> <div>Two</div> <div class="nested"> <div>Nested One</div> <div>Nested Two</div> </div> </div> <div class="grid"> <div>One</div> <div>Two</div> <div class="nested"> <div>Nested One</div> <div>Nested Two</div> </div> </div> https://codepen.io/rachelandrew/pen/GEZPex
  • 35. .flex { display: flex; border: 8px solid rgb(3,99,143); } .flex > * { flex: 1; border: 8px solid rgb(24,154,153); } .grid { display: grid; border: 8px solid rgb(3,99,143); grid-template-columns: repeat(4,minmax(200px, 1fr)); grid-gap: 8px; } .grid > * { border: 8px solid rgb(24,154,153); } https://codepen.io/rachelandrew/pen/GEZPex
  • 37. .flex > * { flex: 1; border: 8px solid rgb(24,154,153); } .grid > * { border: 8px solid rgb(24,154,153); }
  • 38.
  • 39. .card { border: 4px solid rgb(24,154,153); background-color: #fff; display: contents; } display: contents We add this to the direct child of the grid container. https://codepen.io/rachelandrew/pen/QgNJYa
  • 40.
  • 42. .card { border: 4px solid rgb(24,154,153); background-color: #fff; grid-row: auto / span 4; display: contents; } Make room for the rows Each card needs four rows.
  • 43. .card:nth-child(1) h2{ grid-column: 1; grid-row: 1; } .card:nth-child(1) img{ grid-column: 1; grid-row: 2; } .card:nth-child(1) .inner{ grid-column: 1; grid-row: 3; } .card:nth-child(1) footer{ grid-column: 1; grid-row: 4; } .card:nth-child(2) h2{ grid-column: 2; grid-row: 1; } .card:nth-child(2) img{ grid-column: 2; grid-row: 2; } .card:nth-child(2) .inner{ grid-column: 2; grid-row: 3; } .card:nth-child(2) footer{ grid-column: 2; grid-row: 4; } .card:nth-child(3) h2{ grid-column: 3; grid-row: 1; } .card:nth-child(3) img{ grid-column: 3; grid-row: 2; } .card:nth-child(3) .inner{ grid-column: 3; grid-row: 3; } .card:nth-child(3) footer{ grid-column: 3; grid-row: 4; } .card:nth-child(4) h2{ grid-column: 1; grid-row: 5; } .card:nth-child(4) img{ grid-column: 1; grid-row: 6; } .card:nth-child(4) .inner{ grid-column: 1; grid-row: 7;} .card:nth-child(4) footer{ grid-column: 1; grid-row: 8; } .card:nth-child(5) h2{ grid-column: 2; grid-row: 5; } .card:nth-child(5) img{ grid-column: 2; grid-row: 6; } .card:nth-child(5) .inner{ grid-column: 2; grid-row: 7; } .card:nth-child(5) footer{ grid-column: 2; grid-row: 8; } .card:nth-child(6) h2{ grid-column: 3; grid-row: 5; } .card:nth-child(6) img{ grid-column: 3; grid-row: 6; } .card:nth-child(6) .inner{ grid-column: 3; grid-row: 7; } .card:nth-child(6) footer{ grid-column: 3; grid-row: 8; } Ugh. Donā€™t do this. https://codepen.io/rachelandrew/pen/QgNJYa
  • 44.
  • 45. display: contents ā–ø Use when the element you are removing has no box styling (e.g. backgrounds and borders) attached ā–ø Current browser support Firefox, Chrome Canary
  • 46. It is all logical.
  • 47. /* this shorthand */ .a { grid-area: 1 / 2 / 2 / 5; } /* is the same as this */ .a { grid-row-start: 1; grid-column-start: 2; grid-row-end: 2; grid-column-end: 5; } The order of values in grid-area ā€¢row-start ā€¢column-start ā€¢row-end ā€¢column-end
  • 48. .grid { display: grid; grid-gap: 10px; grid-template-columns: repeat(4, 150px); grid-template-rows: repeat(3, 100px); } .a { grid-area: 1 / 2 / 2 / 5; } .b { grid-area: 1 / 1 / 3 / 4; } https://codepen.io/rachelandrew/pen/BZKbaN
  • 49. .grid { Direction: rtl; display: grid; grid-gap: 10px; grid-template-columns: repeat(4, 150px); grid-template-rows: repeat(3, 100px); } .a { grid-area: 1 / 2 / 2 / 5; } .b { grid-area: 1 / 1 / 3 / 4; } https://codepen.io/rachelandrew/pen/BZKbaN
  • 50. CSS Logical Properties ā€œThis module introduces logical properties and values that provide the author with the ability to control layout through logical, rather than physical, direction and dimension mappings. The module deļ¬nes logical properties and values for the features deļ¬ned inĀ CSS2.1. These properties are writing-mode relative equivalents of their corresponding physical properties.ā€
  • 51. Logical not Physical ā–ø The start of a page rather than the top ā–ø The end of a block rather than the right ā–ø In grid layout we have start and end for both columns and rows, rather than referring to the top and bottom of columns and left and right of rows
  • 52. .grid { display: grid; grid-gap: 10px; grid-template-columns: repeat(3, 150px); grid-template-rows: repeat(3, 100px); justify-content: end; align-content: end; } https://codepen.io/rachelandrew/pen/pwyBpG End End Start Start direction: ltr
  • 53. .grid { display: grid; grid-gap: 10px; grid-template-columns: repeat(3, 150px); grid-template-rows: repeat(3, 100px); justify-content: end; align-content: end; } https://codepen.io/rachelandrew/pen/pwyBpG End End Start Start direction: rtl
  • 57. .Prose { display: grid; grid-template-columns: [full-start] minmax(1em, 1fr) [main-start] minmax(0, 40em) [main-end] minmax(1em, 1fr) [full-end]; } .Prose > * { grid-column: main; } .Prose-splash { grid-column: full; } Just do this! Magic occurs.
  • 58.
  • 59. <div class="grid"> <div>Content</div> <div class="gallery">Full width content</div> <div>Content</div> </div> My markup A div containing three direct child elements, one with a class of ā€˜galleryā€™. Thatā€™s our full width content.
  • 60. .grid { display: grid; grid-template-columns: minmax(1em, 1fr) minmax(0, 660px) minmax(1em, 1fr); } .grid > * { grid-column: 2 ; } .grid > .gallery { grid-column: 1 / -1 ; } A grid with 3 column tracks Using the line numbers to place our content and full width items. https://codepen.io/rachelandrew/pen/mwOmJW
  • 61. 1 2 3 4
  • 62. 1 2 3 4 grid-column: 2; grid-column: 1 / 4; grid-column: 2;
  • 63.
  • 64. .grid { display: grid; grid-template-columns: [full-start] minmax(1em, 1fr) [main-start] minmax(0, 660px) [main-end] minmax(1em, 1fr) [full-end]; } .grid > * { grid-column: main-start; } .grid > .gallery { grid-column: full-start / full-end; } Naming lines on the grid We can now position the items using their line names. https://codepen.io/rachelandrew/pen/EXjrJM
  • 66. grid-column: main-start; grid-column: full-start / full-end; full-start main-start main-end full-end grid-column: main-start;
  • 67. grid-column: main; grid-column: full; full-start main-start main-end full-end grid-column: main;
  • 68. .grid { display: grid; max-width: 960px; margin: 0 auto; grid-template-columns: [full-start] minmax(1em, 1fr) [main-start] minmax(0, 660px) [main-end] minmax(1em, 1fr) [full-end]; } .grid > * { grid-column: main; } .grid > .gallery { grid-column: full; } ā€˜mainā€™ and ā€˜fullā€™ These line names donā€™t exist anywhere in our grid deļ¬nition.
  • 69. https://www.w3.org/TR/css-grid-1/#implicit-named-areas ā€œSince a named grid area is referenced by the implicit named lines it produces, explicitly adding named lines of the same form (foo-start/foo-end) eļ¬€ectively creates a named grid area. ā€
  • 71. .grid { display: grid; grid-gap: 20px; grid-template-columns: 100px [main-start] 100px 100px 100px [main-end] 100px 100px; grid-template-rows: 100px [main-start] 100px 100px [main-end] 100px; } .item { grid-area: main; } Implicit named areas Created by having named lines using an ident with *-start and *-end. https://codepen.io/rachelandrew/pen/EXNmvj
  • 72. .grid { display: grid; grid-template-columns: [full-start] minmax(1em, 1fr) [main-start] minmax(0, 660px) [main- end] minmax(1em, 1fr) [full-end]; grid-template-rows: auto auto [full- start] auto [full-end]; } .grid > * { grid-column: main-start; } .grid > .gallery { grid-area: full; } Magic named area We have deļ¬ned lines named full- start and full-end for rows and columns so we have an area named full. https://codepen.io/rachelandrew/pen/jwPjWK
  • 73. https://www.w3.org/TR/css-grid-1/#line-placement ā€œNote: Named grid areas automatically generate implicit named lines of this form, so specifying grid-row-start: foo will choose the start edge of that named grid area (unless another line named foo-start was explicitly speciļ¬ed before it).ā€
  • 74. Named lines create a named area which in turn can be used as named lines.
  • 75. https://www.w3.org/TR/css-grid-1/#placement-shorthands ā€œ[when using grid-row and grid-column shorthands] ā€¦ When the second value is omitted, if the ļ¬rst value is a <custom-ident>, the grid-row- end/grid-column-end longhand is also set to that <custom-ident>; otherwise, it is set to auto.ā€
  • 76. grid-column: main; grid-column: full; full-start main-start main-end full-end grid-column: main;
  • 77. grid-column: main / main; grid-column: full / full; full-start main-start main-end full-end grid-column: main / main; full fullmain main
  • 78. .grid { display: grid; max-width: 960px; margin: 0 auto; grid-template-columns: [full-start] minmax(1em, 1fr) [main-start] minmax(0, 660px) [main-end] minmax(1em, 1fr) [full-end]; } .grid > * { grid-column: main; } .grid > .gallery { grid-column: full; } Targeting the column track The line name ā€˜mainā€™ is created from the named area created by our named lines. https://codepen.io/rachelandrew/pen/owXKMd
  • 79.
  • 80. .grid { display: grid; grid-template-columns: [full-start panel1-start] 1fr 1fr [content-start] 1fr 1fr 1fr 1fr [panel1- end panel2-start ] 1fr 1fr 1fr 1fr [content-end] 1fr 1fr [panel2-end full-end] ; } .grid > * { grid-column: content; } .grid > .gallery { grid-column: full; } .grid > .panel1 { grid-column: panel1; padding: 4px; } .grid > .panel2 { grid-column: panel2; padding: 4px; } Extending the example Adding named areas panel1 and panel2. https://codepen.io/rachelandrew/pen/YQXmJJ/
  • 81. .grid { display: grid; grid-template-columns: minmax(1em, 1fr) minmax(0, 660px) minmax(1em, 1fr); grid-template-areas: ". title ." ". content-top ." "full-width full-width full-width" ". content-bottom ." } h1 { grid-area: title; } .content1 { grid-area: content-top; } .content2 { grid-area: content-bottom; } .gallery { grid-area: full-width; } Magic Grid Lines If you have a named area you get grid lines named *-start and *-end for rows and columns. https://codepen.io/rachelandrew/pen/qjdzwR
  • 82.
  • 83. .grid { display: grid; grid-template-columns: minmax(1em, 1fr) minmax(0, 660px) minmax(1em, 1fr); grid-template-areas: ". title ." ". content-top ." "full-width full-width full-width" ". content-bottom ." } h1 { grid-area: title; } .content1 { grid-area: content-top; } .content2 { grid-area: content-bottom; } .gallery { grid-area: full-width; } Magic Grid Lines Each grid-area creates a set of lines for the start and end of the area - rows and columns. For title, we have title-start and title- end for rows and columns. https://codepen.io/rachelandrew/pen/qjdzwR
  • 84. .grid::after { content: ""; background-color: #fff; border: 4px solid rgb(182,222,211); grid-column: content-top-start / content-top-end; grid-row: title-start / content-bottom-end; z-index: -1; } Magic Lines Positioning some generated content using the magical lines. https://codepen.io/rachelandrew/pen/qjdzwR
  • 85.
  • 86. Things appearing ā€Ø in unexpected places.
  • 87. .grid { display: grid; grid-gap: 10px; grid-template-columns: 100px [main-start] 100px 100px [main-end]; } .a { grid-column: 1 / 3; grid-row: 1; } .b { grid-column: 3; grid-row: 1 / 3; } .c { grid-column: 1; } .d { grid-column: 2; grid-row: 2; } https://codepen.io/rachelandrew/pen/JJYxve/
  • 88. .grid { display: grid; grid-gap: 10px; grid-template-columns: 100px [main- start] 100px 100px [main-end]; } .e { grid-area: main; } https://codepen.io/rachelandrew/pen/JJYxve/
  • 89. .grid { display: grid; grid-gap: 10px; grid-template-columns: 100px [main- start] 100px 100px [main-end]; } .e { grid-area: auto/ main; } https://codepen.io/rachelandrew/pen/JJYxve/
  • 91. Find out more I made you some resources Visit Grid by Example for worked examples, patterns with fallbacks, and a free video tutorial:ā€Ø gridbyexample.com I created a huge set of guides for MDN: ā€Ø https://developer.mozilla.org/en-US/docs/Web/CSS/ CSS_Grid_Layout Over 4 years of grid thoughts on my site at:ā€Ø https://rachelandrew.co.uk/archives/tag/cssgrid CSS Grid AMA:ā€Ø https://github.com/rachelandrew/cssgrid-ama ā€Ø
  • 92. THANK YOU! @rachelandrewā€Ø ā€Ø Resources & code: https://rachelandrew.co.uk/speaking/event/cssday-nl-2017