SlideShare a Scribd company logo
CSS Grid layout - De volta para o futuro
@afonsopacifer
Front-End
Developer
#WriteCodeEveryDay.
I CSS
CSS Grid Layout?
Um modulo CSS3 que define um grid
otimizado para interfaces
CSS Grid Layout Module Level 1
O futuro!
Flexbox
Interfaces simplesInterfaces complexas
Grid Layout
X É o presenteÉ o futuro
São diferentes e complementares!
Use os dois!
https://github.com/afonsopacifer/awesome-flexbox
A curated list of CSS Flexible Box Layout Module or only Flexbox.
AVISO!
Working Draft
http://www.w3.org/TR/css-grid-1/
Terminologia
Grid Lines
São as linhas que dividem o grid.
Grid Tracks
É o termo genérico para o espaço entre
duas grid lines, verticais ou horizontais.
Grid Cells
Também conhecida como grid item.
É o espaçamento entre duas line grids verticais
e duas horizontais.
Grid Areas
Um ou mais grid items (grid cells)
Show me the code
<div class=“container”>
<div class=“a”>A</div>
<div class=“b”>B</div>
<div class=“c”>C</div>
<div class=“d”>D</div>
<div class=“e”>E</div>
<div class=“f”>F</div>
</div>
HTML
Grid Container
.container {
display: grid;
}
.container {
display: inline-grid;
}
Line-based placement
.container {
display: inline-grid;
}
A B C
D E F
1 column 2 column 3 column
2row1row3row
grid-template-rows:
100px 100px;
grid-template-columns:
120px 120px 120px;
100px;
Line-based positioning
.a {
}
B C
D
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 2;
A
E
.f {
}
grid-column-start: 3;
grid-column-end: 4;
grid-row-start: 2;
grid-row-end: 3;
F
Line-based positioning
Shorthand
B C
D
A
E F.a {
}
grid-column: 1 / 2;
grid-row: 1 / 2;
.a {
}
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 2;
.a {
}
grid-area: 1 / 1 / 2 / 2;
Responsive Web Design
Redefinindo o grid
C D
A
E F
.a {grid-area: 1 / 1 / 2 / 4;}
.b {grid-area: 2 / 1 / 3 / 2;}
.c {grid-area: 2 / 2 / 2 / 3;}
.d {grid-area: 2 / 3 / 2 / 4;}
.e {grid-area: 3 / 1 / 4 / 3;}
.d {grid-area: 3 / 3 / 4 / 4;}
B
@media screen and (max-width: 666px) {
}
.a {grid-area: 3 / 1 / 2 / 4;}
.e {grid-area: 1 / 1 / 2 / 3;}
.d {grid-area: 1 / 3 / 2 / 4;}
b c d
e f
A
fr
A nova unidade de medida
flex
A B C
.container {
display: grid;
}
grid-template-rows:
100px;
grid-template-columns:
100px auto 100px;
A B C
.container {
display: grid;
}
grid-template-rows:
100px;
grid-template-columns:
100px 1fr 100px;
.container {
display: grid;
}
grid-template-rows:
100px;
grid-template-columns:
1fr 1fr 1fr;
.container {
display: grid;
}
grid-template-rows:
100px;
grid-template-columns:
2fr 1fr 1fr;
A B C
1 + 1 + 1 = 3
1 1 1
2 + 1 + 1 = 4
A B C
2 1 1
Nomeando as areas
Modo Hardcore
.a {grid-area: header;}
.b {grid-area: aside;}
.c {grid-area: main;}
.d {grid-area: footer;}
.container {
display: grid;
grid-template-rows: auto;
grid-template-columns: auto;
grid-template-areas:
“header header header”
“aside . main”
“aside content content”
“. . footer”;
}
main
header
content
aside
footer
E muito mais
Qual navegador suporta isso?
sintaxe antiga
Browsers support
http://caniuse.com/css-grid
Vale a pena aprender?
Suporte dos navegadores
visto por outro angulo
http://igalia.github.io/css-grid-layout/enable.html
Revista W - 2013
Best New Web Technology
https://thenetawards.com/vote/web-tech/css-grid-layout/
Eu quero usar hoje!
css-grid-polyfill
https://github.com/FremyCompany/css-grid-polyfill
Onde posso aprender mais?
Grid by Example
http://gridbyexample.com/
https://github.com/afonsopacifer/learning-css-grid-layout
Learning CSS Grid Layout
Obrigado :)

More Related Content

PDF
Solving Layout Problems with CSS Grid & Friends - NordicJS
PPTX
Everything You know about CSS is Wrong
ODP
Mapnik Sotm 2007
PDF
Web Summer Camp Keynote
PDF
Solving Layout Problems with CSS Grid & Friends - WEBU17
PDF
Laying out the future with grid & flexbox - Smashing Conf Freiburg
PPTX
Paging
PDF
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
Solving Layout Problems with CSS Grid & Friends - NordicJS
Everything You know about CSS is Wrong
Mapnik Sotm 2007
Web Summer Camp Keynote
Solving Layout Problems with CSS Grid & Friends - WEBU17
Laying out the future with grid & flexbox - Smashing Conf Freiburg
Paging
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)

Viewers also liked (6)

PDF
CSS Grid Layout w/ Blueprint CSS
PDF
Grids of Tomorrow: CSS Grid Layout
PDF
¡Hola flexbox! Adiós float...
PDF
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
PDF
Talk Web Design: Get Ready For CSS Grid Layout
PDF
The Great State of Design with CSS Grid Layout and Friends
CSS Grid Layout w/ Blueprint CSS
Grids of Tomorrow: CSS Grid Layout
¡Hola flexbox! Adiós float...
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
Talk Web Design: Get Ready For CSS Grid Layout
The Great State of Design with CSS Grid Layout and Friends
Ad

Similar to CSS Grid layout - De volta para o futuro (20)

PDF
Devoxx Belgium: CSS Grid Layout
PDF
An Event Apart SF: CSS Grid Layout
PDF
An Event Apart Nashville: CSS Grid Layout
PDF
CSS Grid Layout for Topconf, Linz
PDF
What I discovered about layout vis CSS Grid
PDF
View Source London: Solving Layout Problems with CSS Grid & Friends
PDF
Solving Layout Problems with CSS Grid & Friends - DevFest17
PDF
Grid and Flexbox - Smashing Conf SF
PDF
Start Using CSS Grid Layout Today - RuhrJS
PDF
404.ie: Solving Layout Problems with CSS Grid & Friends
PDF
Render Conf: Start using CSS Grid Layout Today
PDF
Solving Layout Problems With CSS Grid and Friends
PDF
CSS Day: CSS Grid Layout
PDF
CSS Grid Layout
PDF
The Grid - The Future of CSS Layout
PDF
Google Developers Experts Summit 2017 - CSS Layout
PDF
World of CSS Grid
PDF
Introducing CSS Grid Layout
PDF
Flexbox and Grid Layout
PDF
Introduction to CSS Grid Layout
Devoxx Belgium: CSS Grid Layout
An Event Apart SF: CSS Grid Layout
An Event Apart Nashville: CSS Grid Layout
CSS Grid Layout for Topconf, Linz
What I discovered about layout vis CSS Grid
View Source London: Solving Layout Problems with CSS Grid & Friends
Solving Layout Problems with CSS Grid & Friends - DevFest17
Grid and Flexbox - Smashing Conf SF
Start Using CSS Grid Layout Today - RuhrJS
404.ie: Solving Layout Problems with CSS Grid & Friends
Render Conf: Start using CSS Grid Layout Today
Solving Layout Problems With CSS Grid and Friends
CSS Day: CSS Grid Layout
CSS Grid Layout
The Grid - The Future of CSS Layout
Google Developers Experts Summit 2017 - CSS Layout
World of CSS Grid
Introducing CSS Grid Layout
Flexbox and Grid Layout
Introduction to CSS Grid Layout
Ad

Recently uploaded (20)

PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Digital Literacy And Online Safety on internet
PPTX
innovation process that make everything different.pptx
DOCX
Unit-3 cyber security network security of internet system
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Cloud-Scale Log Monitoring _ Datadog.pdf
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Digital Literacy And Online Safety on internet
innovation process that make everything different.pptx
Unit-3 cyber security network security of internet system
Exploring VPS Hosting Trends for SMBs in 2025
Design_with_Watersergyerge45hrbgre4top (1).ppt
Unit-1 introduction to cyber security discuss about how to secure a system
An introduction to the IFRS (ISSB) Stndards.pdf
Tenda Login Guide: Access Your Router in 5 Easy Steps
PptxGenJS_Demo_Chart_20250317130215833.pptx
introduction about ICD -10 & ICD-11 ppt.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Power Point - Lesson 3_2.pptx grad school presentation
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
522797556-Unit-2-Temperature-measurement-1-1.pptx
SAP Ariba Sourcing PPT for learning material
The New Creative Director: How AI Tools for Social Media Content Creation Are...

CSS Grid layout - De volta para o futuro