SlideShare a Scribd company logo
CSS GRID LAYOUT
IS JUST AROUND
THE CORNER
MANUEL REGO CASASNOVAS ( )@regocas
CSSConf US 2015 / 18-19 June 2015 (New York)
ABOUT ME
CSS Grid Layout implementor (Chromium/Blink &
Safari/WebKit)
Member of Igalia Web Platform Team
CSS Grid Layout is Just Around the Corner (CSSConf US 2015)
GRIDS EVERYWHERE
1996
EVOLUTION
Tables
Floats
Inlines
CSS Frameworks
CSS Flexible Box
CSS Grid Layout
CSS Grid Layout is Just Around the Corner (CSSConf US 2015)
GRID CONCEPTS
Header
MainAside
Footer
GRID LINES
Header
MainAside
Footer
1 2 3
1
2
3
4
GRID TRACKS
GRID TRACKS
ROWS
Header
MainAside
Footer
GRID TRACKS
COLUMNS
Header
MainAside
Footer
GRID CELLS
Header
MainAside
Footer
GRID AREAS
Header
MainAside
Footer
CSS Grid Layout is Just Around the Corner (CSSConf US 2015)
DISPLAY: GRID;
New formatting context
TRACK SIZING
grid-template-columns& grid-template-rows
Create boxes from CSS!
TRACK SIZING EXAMPLE
A
B
C
D
.grid { display: grid;
grid-template-columns: ;
grid-template-rows: ; }
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " a " > A < / d i v >
< d i v c l a s s = " b " > B < / d i v >
< d i v c l a s s = " c " > C < / d i v >
< d i v c l a s s = " d " > D < / d i v >
< / d i v >
PLACEMENT PROPERTIES
grid-column& grid-row
DOM order ≠ Visual order
PLACEMENT EXAMPLE
A
B
C
.grid { display: grid;
grid: 200px 200px / 100px 100px; }
.a { }
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " a " > A < / d i v >
< d i v c l a s s = " b " > B < / d i v >
< d i v c l a s s = " c " > C < / d i v >
< / d i v >
GRID AREAS
grid-template-areas
### ###### ###### #### #### ### ######## ########
## ## ## ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
## ## ###### ## ## ## ## ## ######## ##
######### ## ## ## ## ######### ## ## ##
## ## ## ## ## ## ## ## ## ## ## ## ##
## ## ###### ###### #### #### ## ## ## ## ##
GRID AREAS EXAMPLE
A
B
C
D
.grid { display: grid;
grid-auto-columns: 100px; grid-auto-rows: 75px;
grid-template-areas: "head head"
"nav main"
"foot foot"; }
.a { grid-area: head; }
.b { grid-area: main; }
.c { grid-area: nav; }
.d { grid-area: foot; }
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " a " > A < / d i v >
< d i v c l a s s = " b " > B < / d i v >
< d i v c l a s s = " c " > C < / d i v >
< d i v c l a s s = " d " > D < / d i v >
< / d i v >
AUTO-PLACEMENT
grid-auto-flow
AUTO-PLACEMENT EXAMPLE
Input
Checkbox Submit form
form { }
label { }
input { }
< f o r m >
< l a b e l > I n p u t < / l a b e l >
< i n p u t >
< l a b e l > C h e c k b o x < / l a b e l >
< i n p u t t y p e = " c h e c k b o x " >
< b u t t o n > S u b m i t f o r m < / b u t t o n >
< / f o r m >
ALIGNMENT
specCSS Box Alignment
Horizontal & vertical centering!
ALIGNMENT EXAMPLE
A
B
C
D
.grid { display: grid; grid: 200px 200px / 100px 100px;
align-items: ; justify-items: ; }
.b, .c { width: 100px; }
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " a " > A < / d i v >
< d i v c l a s s = " b " > B < / d i v >
< d i v c l a s s = " c " > C < / d i v >
< d i v c l a s s = " d " > D < / d i v >
< / d i v >
RESPONSIVE GRIDS
Flexible track sizing
Media Queries
RESPONSIVE GRID EXAMPLE
. g r i d {
d i s p l a y : g r i d ;
g r i d : 2 0 0 p x 1 f r / 1 0 0 p x 1 f r a u t o ;
g r i d - t e m p l a t e - a r e a s : " h e a d e r h e a d e r "
" a s i d e m a i n "
" a s i d e f o o t e r " ;
}
@ m e d i a ( m a x - w i d t h : 4 0 0 p x ) {
. g r i d {
g r i d : 1 f r / 1 0 0 p x 1 f r 1 0 0 p x a u t o ;
g r i d - t e m p l a t e - a r e a s : " h e a d e r "
" m a i n "
" a s i d e "
" f o o t e r " ; }
}
RESPONSIVE GRID EXAMPLE
Header
MainAside
Footer
CSS Grid Layout is Just Around the Corner (CSSConf US 2015)
ROW/COLUMN GAPS
A
B
C
.grid { display: grid;
grid: 100px 25px 100px 25px 100px / 100px; }
.a { grid-column: 1; }
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " a " > A < / d i v >
< d i v c l a s s = " b " > B < / d i v >
< d i v c l a s s = " c " > C < / d i v >
< / d i v >
Proposal: reuse column-gap& introduce row-gap
ROW/COLUMN GAPS
Fake with alignment
A
B
C
.grid { display: grid;
grid: 100px 100px 100px / 100px;
justify-content: space-between; }
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " a " > A < / d i v >
< d i v c l a s s = " b " > B < / d i v >
< d i v c l a s s = " c " > C < / d i v >
< / d i v >
SUBGRIDS
Nested Grid
A B C
D
E
S1 Sub2
S
2
Sub
4
A B C
D
E
S1 Sub2
S
2
Sub
4
Subgrid
SUBGRIDS EXAMPLE
Input
Checkbox
Submit form
ul { display: grid; }
li { display: grid; }
label { grid-column: 1; }
< f o r m > < u l >
< l i > < l a b e l > I n p u t < / l a b e l > < i n p u t
< l i > < l a b e l > C h e c k b o x < / l a b e l > < i n p u t
< l i > < b u t t o n > S u b m i t f o r m < / b u t t o n
< / u l > < / f o r m >
HOW DOES IT WORK?
EXAMPLE
< d i v c l a s s = " g r i d " >
< d i v c l a s s = " t i t l e " > T i t l e < / d i v >
< d i v c l a s s = " n a v " > N a v < / d i v >
< d i v c l a s s = " m a i n " > L o r e m i p s u m . . . < / d i v >
< d i v c l a s s = " a s i d e " > A d < / d i v >
< d i v c l a s s = " a s i d e " > A d w o r d < / d i v >
< / d i v >
. g r i d { d i s p l a y : g r i d ;
w i d t h : 4 0 0 p x ;
g r i d - t e m p l a t e - c o l u m n s : 1 0 0 p x 1 f r a u t o ;
g r i d - t e m p l a t e - r o w s : 5 0 p x a u t o ; }
. t i t l e { g r i d - r o w : 1 ; g r i d - c o l u m n : 2 ; }
. n a v { g r i d - r o w : 2 ; g r i d - c o l u m n : 1 ; }
. m a i n { g r i d - r o w : 2 ; g r i d - c o l u m n : 2 ; }
. a s i d e { g r i d - c o l u m n : 3 ; }
EMPTY GRID
PLACE ITEMS
Title
.title { grid-row: 1; grid-column: 2; }
PLACE ITEMS
Title
Nav
.nav { grid-row: 2; grid-column: 1; }
PLACE ITEMS
Lorem ipsum...
Title
Nav
.main { grid-row: 2; grid-column: 2; }
PLACE ITEMS
Lorem ipsum...
Title
Nav
Ad
.aside { grid-column: 3; }
PLACE ITEMS
Lorem ipsum...
Title
Nav
Ad
Adword
.aside { grid-column: 3; }
PLACE ITEMS
Lorem ipsum...
Title
Nav
Ad
Adword
FIXED COLUMN
Lorem ipsum...
Title
Nav
Ad
Adword
100px
INTRINSIC COLUMN
Lorem ipsum...
Title
Nav
100px auto
Ad
Adword
30px
70px
INTRINSIC COLUMN
Lorem ipsum...
Title
Nav
100px 70px
Ad
Adword
FLEXIBLE COLUMN
Lorem ipsum...
Title
Nav
100px 1fr 70px
Ad
Adword
FLEXIBLE COLUMN
Lorem ipsum...
Title
Nav
100px 230px 70px
Ad
Adword
LAYOUT ITEMS
100px 230px 70px
Ad
Adword
Title
Nav Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor
incididunt ut labore et dolore
magna aliqua.
FIXED ROW
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor
incididunt ut labore et dolore
magna aliqua.
100px 230px 70px
Ad
Adword
Title
Nav
50px
INTRINSIC ROW
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor
incididunt ut labore et dolore
magna aliqua.
100px 230px 70px
Ad
Adword
Title
Nav
50px
auto
30px
120px
30px
INTRINSIC ROW
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor
incididunt ut labore et dolore
magna aliqua.
100px 230px 70px
Ad
Adword
Title
Nav
50px
120px
STRETCH ITEMS
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor
incididunt ut labore et dolore
magna aliqua.
100px 230px 70px
Ad
Adword
Title
Nav
50px
120px
FASTER GRIDS
FIXED VS INTRINSIC SIZING
100pxis faster than auto
INTRINSIC VS FLEXIBLE SIZING
autois faster than 1fr
STRETCH IN AUTO SIZED ITEMS
stretchis slower than other (e.g. start)
STATUS
W3C SPECIFICATION
CSS Grid Layout - http://dev.w3.org/csswg/css-grid/
Started by Microsoft in 2010
Last Working Draft 17 March 2015
W3C Test Suite
CAN I USE GRID? ὢ
BROWSERS ADOPTION ὠ
Old implementation
since version 10
Prefixed: -ms
More complete
implementation
⚐Experimental Web
Platform Features
Enabled by default on
WebKit Nightlies
Prefixed: -webkit
Implementation started
on 2015
⚐layout.css.grid.enabled
Polyfill: https://github.com/FremyCompany/css-grid-polyfill
EXAMPLES
by Igalia
by Rachel Andrew
http://igalia.github.io/css-grid-layout/
http://gridbyexample.com/
ACKNOWLEDGEMENTS
and working together to build a better
web
Igalia Bloomberg
THANK YOU!
Twitter:
Mail:
Blog:
@regocas
rego@igalia.com
http://blogs.igalia.com/mrego/

More Related Content

DOC
Teddy Bear Blue
PDF
Rapid Prototyping
PPT
CSS 3 Overview
PDF
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
KEY
Creating Art with Codes - CSS3
PDF
More of less (take 2)
PDF
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
PDF
Grids of Tomorrow: CSS Grid Layout
Teddy Bear Blue
Rapid Prototyping
CSS 3 Overview
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
Creating Art with Codes - CSS3
More of less (take 2)
CSS Grid Layout. Specification overview. Implementation status and roadmap (B...
Grids of Tomorrow: CSS Grid Layout

Similar to CSS Grid Layout is Just Around the Corner (CSSConf US 2015) (20)

PPTX
Introduction to CSS Grid
PDF
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
PDF
The Backside of the Class (CSS Day 2015)
PDF
Responsive Design Tools & Resources
PDF
Jina Bolton
PDF
R57php 1231677414471772-2
PDF
Using Core Themes in Drupal 8
PDF
The CSS3 of Tomorrow (Version 2)
PDF
Edge trends mizuno-template
PDF
World of CSS Grid
PDF
モダンなCSS設計パターンを考える
PDF
Juggling
PDF
Joomla 3 templates and rtl
DOCX
Theme verdadeiro
PDF
CSS3 ...in 3D!
PDF
モダンなCSS設計パターンを考える
PDF
Juggling
PDF
The CSS3 of Tomorrow
PDF
CAR Email 6.5.02 (d)
DOCX
week4.DS_Store__MACOSXweek4._.DS_Storeweek4final wor.docx
Introduction to CSS Grid
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
The Backside of the Class (CSS Day 2015)
Responsive Design Tools & Resources
Jina Bolton
R57php 1231677414471772-2
Using Core Themes in Drupal 8
The CSS3 of Tomorrow (Version 2)
Edge trends mizuno-template
World of CSS Grid
モダンなCSS設計パターンを考える
Juggling
Joomla 3 templates and rtl
Theme verdadeiro
CSS3 ...in 3D!
モダンなCSS設計パターンを考える
Juggling
The CSS3 of Tomorrow
CAR Email 6.5.02 (d)
week4.DS_Store__MACOSXweek4._.DS_Storeweek4final wor.docx
Ad

More from Igalia (20)

PDF
Life of a Kernel Bug Fix
PDF
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
PDF
Advancing WebDriver BiDi support in WebKit
PDF
Jumping Over the Garden Wall - WPE WebKit on Android
PDF
Collective Funding, Governance and Prioritiation of Browser Engine Projects
PDF
Don't let your motivation go, save time with kworkflow
PDF
Solving the world’s (localization) problems
PDF
The Whippet Embeddable Garbage Collection Library
PDF
Nobody asks "How is JavaScript?"
PDF
Getting more juice out from your Raspberry Pi GPU
PDF
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
PDF
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
PDF
CSS :has() Unlimited Power
PDF
Device-Generated Commands in Vulkan
PDF
Current state of Lavapipe: Mesa's software renderer for Vulkan
PDF
Vulkan Video is Open: Application showcase
PDF
Scheme on WebAssembly: It is happening!
PDF
EBC - A new backend compiler for etnaviv
PDF
RISC-V LLVM State of the Union
PDF
Device-Generated Commands in Vulkan
Life of a Kernel Bug Fix
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
Advancing WebDriver BiDi support in WebKit
Jumping Over the Garden Wall - WPE WebKit on Android
Collective Funding, Governance and Prioritiation of Browser Engine Projects
Don't let your motivation go, save time with kworkflow
Solving the world’s (localization) problems
The Whippet Embeddable Garbage Collection Library
Nobody asks "How is JavaScript?"
Getting more juice out from your Raspberry Pi GPU
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
CSS :has() Unlimited Power
Device-Generated Commands in Vulkan
Current state of Lavapipe: Mesa's software renderer for Vulkan
Vulkan Video is Open: Application showcase
Scheme on WebAssembly: It is happening!
EBC - A new backend compiler for etnaviv
RISC-V LLVM State of the Union
Device-Generated Commands in Vulkan
Ad

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
A Presentation on Artificial Intelligence
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Empathic Computing: Creating Shared Understanding
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
Diabetes mellitus diagnosis method based random forest with bat algorithm
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Monthly Chronicles - July 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
Chapter 3 Spatial Domain Image Processing.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Empathic Computing: Creating Shared Understanding

CSS Grid Layout is Just Around the Corner (CSSConf US 2015)