SlideShare uma empresa Scribd logo
1 de 58
Baixar para ler offline
SIMONE LELLI
UI Designer & Developer @ Objectway
I like drawing, coding and cooking…
...COOKING?
YES! WE'RE GOING TO COOK AMAZING
LAYOUTS!
CSS GRID: WHY I'M ENTHUSIAST
I was a graphic designer
converted to web.
I love UI design and development.
CREATIVITY VS "FORCED" LAYOUT SOLUTIONS
-.-
Tables
Inline blocks
Floats
Flexbox
They are all hacks like this: it looks like an hamburger... but it is a veggie-burger...
...IF YOU WANT A REAL BURGER...
...YOU HAVE TO TAKE A STEP TO THE FUTURE!
WHY SHOULD I LEARN IT TODAY?
TO BE COOL :)
TO DRIVE YOUR TEAM TOMORROW!
WHAT IS IT CSS GRID LAYOUT
MODULE?
Two-dimensional grid layout system
You can use media queries
You can order child elements as you want
HOW CAN I TRY IT NOW?
CHROME
chrome://flags/#enable-experimental-web-platform-
features
FIREFOX
set true layout.css.grid.enabled inside about:config
IE 10-11, EDGE
-ms- prefix early implementation (with some differences)
CSS GRID LAYOUT
TERMINOLOGY
GRID LINES
They can be referred to by numbers or they can be named.
GRID TRACK
The space between two tracks (horizontal or vertical)
GRID CELL
The smallest unit of the grid (space between four tracks).
It's something like a table cell.
GRID AREA
Any area bounded by four lines: it may contain different grid
cells.
GRID GUTTERS
Useful for cases with regular gutter sizes.
DEFINE THE GRID
A grid is defined by a new value of display property:
display: grid
HTML
Define a container with 6 child elements
<div class="grid-wrapper">
<div class="item a">A</div>
<div class="item b">B</div>
<div class="item c">C</div>
<div class="item d">D</div>
<div class="item e">E</div>
<div class="item f">F</div>
</div>
CSS
Defines a grid of 5 columns and 3 rows with different size
.grid-wrapper {
display: grid;
grid-template-columns: 30% 5% 30% 5% 30%;
grid-template-rows: 200px 20px 200px;
}
A B C D E
F
Auto-placement: each item fill the first available cell
but we don't want items inside gutter columns.
HOW TO PUT EACH ITEM IN THE RIGHT PLACE
.a {
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 2;
}
/* SHORTHAND */
.a {
grid-column: 1/2;
grid-row: 1/2;
}
A B C
D E F
Now each item is placed in the right place.
A grid area can span as many cells you want…
A B
C D
A
B
C D
…in all directions and position…
A
BC D
E
Place items where you want! No order problems or
limitations :)
GRID GUTTERS
A B
C D
.table {
grid-row-gap: 20px;
grid-column-gap: 20px;
}
/* Shorthand: row, column */
.table {
grid-gap: 20px 20px;
}
SOMETHING MORE...
You can span a grid area trough cells by lines numbers or
with span keyword: with span you can say "start at line 1
and span 4 lines".
.item {
grid-column: 1 / span 4;
}
/* IS THE SAME OF */
.item {
grid-column: 1 / 5;
}
NAMED LINES
.grid-wrapper {
display: grid;
grid-template-columns: [col1-start] 200px [col1-end] 15px [col2-start
grid-template-rows: [row1-start] 200px [row1-end] 15px [row2-start]
}
POSITIONING ITEMS USING NAMED
LINES
.item.a {
display: grid;
grid-column: col1-start / col1-end;
grid-row: row1-start / row1-end;
}
MAGIC AREAS!
Header
Content
Primary
sidebar
Secondary
sidebar
Footer
Define named areas:
each item is assoaciated to a named area
.header {grid-area: header;}
.content {grid-area: content;}
.sidebar-a {grid-area: sidebar-a;}
.sidebar-b {grid-area: sidebar-b;}
.footer {grid-area: footer;}
Define grid and place named areas
something like ASCII-art!
.grid-wrapper {
display: grid;
grid-template-columns: 30% 5% 30% 5% 30%;
grid-template-rows: 200px 20px 200px;
grid-template-areas:
"header header header header header"
". . . . ."
"sidebar-a . content . sidebar-b"
". . . . ."
"footer footer footer footer footer"
}
FUNNY CODE, PERFECT RESULT
Header
Content
Primary
sidebar
Secondary
sidebar
Footer
VERY EASY TO CHANGE!
Header
Content
Primary
sidebar
Secondary sidebar Footer
.grid-wrapper.change {
grid-template-areas:
"sidebar-a . content content content"
". . . . ."
"sidebar-b sidebar-b sidebar-b . footer"
". . . . ."
"header header header header header"
}
REPEAT
ANOTHER USEFUL FEATURE
EASY REPEAT A COLUMN/ROW PATTERN AS MANY TIMES
YOU WANT!
.grid-wrapper {
display: grid;
grid-template-columns: repeat(12, [gutter] 10px [col] 1fr);
grid-template-row: repeat(24, [gutter] 10px [row] 80px);
}
THE "FR" UNIT
The fr unit (fraction of available space) can be used for grid-
rows and grid-columns values.
It works as percentages for available space when fixed-sized
and content-based columns/rows have taken their space.
Bye bye Bootstrap,
bye bye Foundation...
ONE MORE FUNNY THING…
OVERLAP
A B C
D F
G
E
control overlaps with z-index
NEXT STEP: NESTED GRIDS
Header
SUB-GRID
SUB-GRID CONTENT
SUB-GRID FOOTER
SUB-GRID
SIDEBAR
Primary
sidebar
Secondary
sidebar
Footer
Outer grid contains another grid defined by display: grid
property. Nested grid is independent by parent.
Nested grids can't inherit column widths from the parent.
. . .
grid: subgrid can do it
but actually is not supported by browsers.
Subgird feature is at-risk
and may be dropped during the CR period.
RESPONSIVE DESIGN
CSS grids can be fully managed inside media queries:
you have great control and unbelievable possibilities for
web layouts.
Redefine elements position and size is very easy.
If you want you could also redefine your grid.
!!! WOOOOOOOOOOOOOOOW !!!
CSS GRID LAYOUT
VS
FLEXBOX
CSS GRID LAYOUT + FLEXBOX
Grid is the best for complex page layouts
Grid is two-dimensional and supports non-linear design
Flexbox is the ideal solution for small page components
Flexbox is one-dimensional and supports linear design;
remember that it works on axis (column and row
direction).
CSS Grid avoids redundant markup!
A WELL-BALANCED MIX OF GRID AND FLEX
IS THE KEY OF BETTER PERFORMANCE.
THAT'S COOL, BUT IN REALITY?
CHROME has the most advanced implementation (Blink).
SAFARI is close to Chrome implementation, prefixed -webkit
on nightlies.
FIREFOX is in development.
IE10+ & EDGE have a working but outdated implementation.
The update to current spec is high priority in backlog.
STATE OF THE SPECIFICATION
Currently Working Dra Level 1: 17 September 2015
Plans to move it forward to Last Call Working Dra
before CR.
USEFUL LINKS
W3C Working Dra
https://www.w3.org/TR/css-grid-1
W3C Editor's Dra
https://dra s.csswg.org/css-grid-1
Polyfill (by Fremy Company)
https://github.com/FremyCompany/css-grid-polyfill
Codepen examples: , ,1 2 3
ENJOY IT!
Thank you ;)
Characters in GIFs are of the respective owners. I'm sorry if I broke some copyright but it wasn't for commercial purposes.

Mais conteúdo relacionado

Mais procurados

The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSSRachel 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
 
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017Morten Rand-Hendriksen
 
CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...
CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...
CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...Igalia
 
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
 
Fluent: Making Sense of the New CSS Layout
Fluent: Making Sense of the New CSS LayoutFluent: Making Sense of the New CSS Layout
Fluent: Making Sense of the New CSS LayoutRachel Andrew
 
Future Layout & Performance
Future Layout & PerformanceFuture Layout & Performance
Future Layout & PerformanceRachel Andrew
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid LayoutRachel Andrew
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid LayoutRachel Andrew
 
Frontend United: Start using CSS Grid Layout today!
Frontend United: Start using CSS Grid Layout today!Frontend United: Start using CSS Grid Layout today!
Frontend United: Start using CSS Grid Layout today!Rachel Andrew
 
Grid and Flexbox - Smashing Conf SF
Grid and Flexbox - Smashing Conf SFGrid and Flexbox - Smashing Conf SF
Grid and Flexbox - Smashing Conf SFRachel Andrew
 
Render Conf: Start using CSS Grid Layout Today
Render Conf: Start using CSS Grid Layout TodayRender Conf: Start using CSS Grid Layout Today
Render Conf: Start using CSS Grid Layout TodayRachel Andrew
 
CSS Grid Layout - All Things Open
CSS Grid Layout - All Things OpenCSS Grid Layout - All Things Open
CSS Grid Layout - All Things OpenRachel Andrew
 
Talk Web Design: Get Ready For CSS Grid Layout
Talk Web Design: Get Ready For CSS Grid LayoutTalk Web Design: Get Ready For CSS Grid Layout
Talk Web Design: Get Ready For CSS Grid LayoutRachel Andrew
 
AEA Chicago CSS Grid Layout
AEA Chicago CSS Grid LayoutAEA Chicago CSS Grid Layout
AEA Chicago CSS Grid LayoutRachel Andrew
 
Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid LayoutRachel Andrew
 

Mais procurados (20)

The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSS
 
CSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzCSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, Linz
 
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
 
CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...
CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...
CSS Grid Layout. Implementation status and roadmap (Webkit Contributors Meeti...
 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS 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
 
Introducing CSS Grid
Introducing CSS GridIntroducing CSS Grid
Introducing CSS Grid
 
Fluent: Making Sense of the New CSS Layout
Fluent: Making Sense of the New CSS LayoutFluent: Making Sense of the New CSS Layout
Fluent: Making Sense of the New CSS Layout
 
Future Layout & Performance
Future Layout & PerformanceFuture Layout & Performance
Future Layout & Performance
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Frontend United: Start using CSS Grid Layout today!
Frontend United: Start using CSS Grid Layout today!Frontend United: Start using CSS Grid Layout today!
Frontend United: Start using CSS Grid Layout today!
 
World of CSS Grid
World of CSS GridWorld of CSS Grid
World of CSS Grid
 
CSS Grid Layout Introduction
CSS Grid Layout IntroductionCSS Grid Layout Introduction
CSS Grid Layout Introduction
 
Grid and Flexbox - Smashing Conf SF
Grid and Flexbox - Smashing Conf SFGrid and Flexbox - Smashing Conf SF
Grid and Flexbox - Smashing Conf SF
 
Render Conf: Start using CSS Grid Layout Today
Render Conf: Start using CSS Grid Layout TodayRender Conf: Start using CSS Grid Layout Today
Render Conf: Start using CSS Grid Layout Today
 
CSS Grid Layout - All Things Open
CSS Grid Layout - All Things OpenCSS Grid Layout - All Things Open
CSS Grid Layout - All Things Open
 
Talk Web Design: Get Ready For CSS Grid Layout
Talk Web Design: Get Ready For CSS Grid LayoutTalk Web Design: Get Ready For CSS Grid Layout
Talk Web Design: Get Ready For CSS Grid Layout
 
AEA Chicago CSS Grid Layout
AEA Chicago CSS Grid LayoutAEA Chicago CSS Grid Layout
AEA Chicago CSS Grid Layout
 
Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid Layout
 

Destaque

The Great State of Design with CSS Grid Layout and Friends
The Great State of Design with CSS Grid Layout and FriendsThe Great State of Design with CSS Grid Layout and Friends
The Great State of Design with CSS Grid Layout and FriendsStacy Kvernmo
 
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
 
Page layout & design task 2
Page layout & design task 2Page layout & design task 2
Page layout & design task 2Craig Cassidy
 
Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...
Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...
Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...Om Prakash Poddar
 
Культурна Адаптація
Культурна АдаптаціяКультурна Адаптація
Культурна АдаптаціяAlyona Owens
 
Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...
Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...
Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...Om Prakash Poddar
 
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)Igalia
 
CSS Grid Layout w/ Blueprint CSS
CSS Grid Layout w/ Blueprint CSS CSS Grid Layout w/ Blueprint CSS
CSS Grid Layout w/ Blueprint CSS Steve Hong
 
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new propertiesPost-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new propertiesBryan Robinson
 
The Best Practices of Symantec Code Signing - RapidSSLonline
The Best Practices of Symantec Code Signing - RapidSSLonlineThe Best Practices of Symantec Code Signing - RapidSSLonline
The Best Practices of Symantec Code Signing - RapidSSLonlineRapidSSLOnline.com
 
Task 3B evaluation of final desgin
Task 3B evaluation of final desginTask 3B evaluation of final desgin
Task 3B evaluation of final desginGaetan Lundula
 

Destaque (20)

ES2015 New Features
ES2015 New FeaturesES2015 New Features
ES2015 New Features
 
The Great State of Design with CSS Grid Layout and Friends
The Great State of Design with CSS Grid Layout and FriendsThe Great State of Design with CSS Grid Layout and Friends
The Great State of Design with CSS Grid Layout and Friends
 
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
 
CSS from the future
CSS from the futureCSS from the future
CSS from the future
 
Page layout & design task 2
Page layout & design task 2Page layout & design task 2
Page layout & design task 2
 
Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...
Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...
Writ Petition Criminal NO.......of 2017 vide D.NO.3913 against Registrar Supr...
 
Культурна Адаптація
Культурна АдаптаціяКультурна Адаптація
Культурна Адаптація
 
Optimize your workflow
Optimize your workflowOptimize your workflow
Optimize your workflow
 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid Layout
 
Metodiskā darba aptauja par 2016. gadu
Metodiskā darba aptauja par 2016. gaduMetodiskā darba aptauja par 2016. gadu
Metodiskā darba aptauja par 2016. gadu
 
Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...
Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...
Appeal against Lodgment Order of Registrar SCI under Order XV Rule 5 of SCI R...
 
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
 
CSS Grid Layout w/ Blueprint CSS
CSS Grid Layout w/ Blueprint CSS CSS Grid Layout w/ Blueprint CSS
CSS Grid Layout w/ Blueprint CSS
 
Grid system introduction
Grid system introductionGrid system introduction
Grid system introduction
 
ТАСО 2016
ТАСО 2016ТАСО 2016
ТАСО 2016
 
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new propertiesPost-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
Post-Modern CSS: Start learning CSS Grid, Flexbox and other new properties
 
The Best Practices of Symantec Code Signing - RapidSSLonline
The Best Practices of Symantec Code Signing - RapidSSLonlineThe Best Practices of Symantec Code Signing - RapidSSLonline
The Best Practices of Symantec Code Signing - RapidSSLonline
 
Presentation2
Presentation2Presentation2
Presentation2
 
Layout, principles
Layout, principlesLayout, principles
Layout, principles
 
Task 3B evaluation of final desgin
Task 3B evaluation of final desginTask 3B evaluation of final desgin
Task 3B evaluation of final desgin
 

Semelhante a Grids of Tomorrow: CSS Grid Layout

The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of LayoutStephen Hay
 
Responsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit HoleResponsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit HoleDan Moriarty
 
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
 
MW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentationMW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentationCharlie Moad
 
The Future of CSS Layout
The Future of CSS LayoutThe Future of CSS Layout
The Future of CSS LayoutZoe Gillenwater
 
Angular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web ApplicationsAngular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web ApplicationsBrent Goldstein
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applicationsVittorio Vittori
 
Step by Step Asp.Net GridView Tutorials
Step by Step Asp.Net GridView TutorialsStep by Step Asp.Net GridView Tutorials
Step by Step Asp.Net GridView TutorialsNilesh kumar Jadav
 
2D Page Layout
2D Page Layout2D Page Layout
2D Page LayoutUnfold UI
 
Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)Ryan Cross
 
CSS- Smacss Design Rule
CSS- Smacss Design RuleCSS- Smacss Design Rule
CSS- Smacss Design Rule皮馬 頑
 
CSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdfCSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdfJonDan6
 
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkNot Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkcrystalenka
 
BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014vzaccaria
 
Web I - 07 - CSS Frameworks
Web I - 07 - CSS FrameworksWeb I - 07 - CSS Frameworks
Web I - 07 - CSS FrameworksRandy Connolly
 
What I discovered about layout vis CSS Grid
What I discovered about layout vis CSS GridWhat I discovered about layout vis CSS Grid
What I discovered about layout vis CSS GridRachel Andrew
 

Semelhante a Grids of Tomorrow: CSS Grid Layout (20)

The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
 
Responsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit HoleResponsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit Hole
 
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
 
MW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentationMW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentation
 
The Future of CSS Layout
The Future of CSS LayoutThe Future of CSS Layout
The Future of CSS Layout
 
Angular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web ApplicationsAngular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web Applications
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
 
Step by Step Asp.Net GridView Tutorials
Step by Step Asp.Net GridView TutorialsStep by Step Asp.Net GridView Tutorials
Step by Step Asp.Net GridView Tutorials
 
2D Page Layout
2D Page Layout2D Page Layout
2D Page Layout
 
Fewd week7 slides
Fewd week7 slidesFewd week7 slides
Fewd week7 slides
 
Fewd week2 slides
Fewd week2 slidesFewd week2 slides
Fewd week2 slides
 
LESS
LESSLESS
LESS
 
Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)
 
CSS- Smacss Design Rule
CSS- Smacss Design RuleCSS- Smacss Design Rule
CSS- Smacss Design Rule
 
INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2
 
CSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdfCSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdf
 
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkNot Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
 
BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014
 
Web I - 07 - CSS Frameworks
Web I - 07 - CSS FrameworksWeb I - 07 - CSS Frameworks
Web I - 07 - CSS Frameworks
 
What I discovered about layout vis CSS Grid
What I discovered about layout vis CSS GridWhat I discovered about layout vis CSS Grid
What I discovered about layout vis CSS Grid
 

Último

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Grids of Tomorrow: CSS Grid Layout

  • 1. SIMONE LELLI UI Designer & Developer @ Objectway
  • 2. I like drawing, coding and cooking… ...COOKING?
  • 3. YES! WE'RE GOING TO COOK AMAZING LAYOUTS!
  • 4. CSS GRID: WHY I'M ENTHUSIAST I was a graphic designer converted to web. I love UI design and development. CREATIVITY VS "FORCED" LAYOUT SOLUTIONS -.-
  • 5. Tables Inline blocks Floats Flexbox They are all hacks like this: it looks like an hamburger... but it is a veggie-burger...
  • 6. ...IF YOU WANT A REAL BURGER...
  • 7. ...YOU HAVE TO TAKE A STEP TO THE FUTURE!
  • 8.
  • 9. WHY SHOULD I LEARN IT TODAY?
  • 11. TO DRIVE YOUR TEAM TOMORROW!
  • 12. WHAT IS IT CSS GRID LAYOUT MODULE? Two-dimensional grid layout system You can use media queries You can order child elements as you want
  • 13. HOW CAN I TRY IT NOW? CHROME chrome://flags/#enable-experimental-web-platform- features FIREFOX set true layout.css.grid.enabled inside about:config IE 10-11, EDGE -ms- prefix early implementation (with some differences)
  • 15. GRID LINES They can be referred to by numbers or they can be named.
  • 16. GRID TRACK The space between two tracks (horizontal or vertical)
  • 17. GRID CELL The smallest unit of the grid (space between four tracks). It's something like a table cell.
  • 18. GRID AREA Any area bounded by four lines: it may contain different grid cells.
  • 19. GRID GUTTERS Useful for cases with regular gutter sizes.
  • 20. DEFINE THE GRID A grid is defined by a new value of display property: display: grid
  • 21. HTML Define a container with 6 child elements <div class="grid-wrapper"> <div class="item a">A</div> <div class="item b">B</div> <div class="item c">C</div> <div class="item d">D</div> <div class="item e">E</div> <div class="item f">F</div> </div>
  • 22. CSS Defines a grid of 5 columns and 3 rows with different size .grid-wrapper { display: grid; grid-template-columns: 30% 5% 30% 5% 30%; grid-template-rows: 200px 20px 200px; }
  • 23. A B C D E F Auto-placement: each item fill the first available cell but we don't want items inside gutter columns.
  • 24. HOW TO PUT EACH ITEM IN THE RIGHT PLACE .a { grid-column-start: 1; grid-column-end: 2; grid-row-start: 1; grid-row-end: 2; } /* SHORTHAND */ .a { grid-column: 1/2; grid-row: 1/2; }
  • 25. A B C D E F Now each item is placed in the right place.
  • 26. A grid area can span as many cells you want… A B C D
  • 27. A B C D …in all directions and position…
  • 28. A BC D E Place items where you want! No order problems or limitations :)
  • 29. GRID GUTTERS A B C D .table { grid-row-gap: 20px; grid-column-gap: 20px; } /* Shorthand: row, column */ .table { grid-gap: 20px 20px; }
  • 30. SOMETHING MORE... You can span a grid area trough cells by lines numbers or with span keyword: with span you can say "start at line 1 and span 4 lines". .item { grid-column: 1 / span 4; } /* IS THE SAME OF */ .item { grid-column: 1 / 5; }
  • 31. NAMED LINES .grid-wrapper { display: grid; grid-template-columns: [col1-start] 200px [col1-end] 15px [col2-start grid-template-rows: [row1-start] 200px [row1-end] 15px [row2-start] }
  • 32. POSITIONING ITEMS USING NAMED LINES .item.a { display: grid; grid-column: col1-start / col1-end; grid-row: row1-start / row1-end; }
  • 34. Define named areas: each item is assoaciated to a named area .header {grid-area: header;} .content {grid-area: content;} .sidebar-a {grid-area: sidebar-a;} .sidebar-b {grid-area: sidebar-b;} .footer {grid-area: footer;}
  • 35. Define grid and place named areas something like ASCII-art! .grid-wrapper { display: grid; grid-template-columns: 30% 5% 30% 5% 30%; grid-template-rows: 200px 20px 200px; grid-template-areas: "header header header header header" ". . . . ." "sidebar-a . content . sidebar-b" ". . . . ." "footer footer footer footer footer" }
  • 36. FUNNY CODE, PERFECT RESULT Header Content Primary sidebar Secondary sidebar Footer
  • 37. VERY EASY TO CHANGE! Header Content Primary sidebar Secondary sidebar Footer
  • 38. .grid-wrapper.change { grid-template-areas: "sidebar-a . content content content" ". . . . ." "sidebar-b sidebar-b sidebar-b . footer" ". . . . ." "header header header header header" }
  • 40. EASY REPEAT A COLUMN/ROW PATTERN AS MANY TIMES YOU WANT! .grid-wrapper { display: grid; grid-template-columns: repeat(12, [gutter] 10px [col] 1fr); grid-template-row: repeat(24, [gutter] 10px [row] 80px); }
  • 41. THE "FR" UNIT The fr unit (fraction of available space) can be used for grid- rows and grid-columns values. It works as percentages for available space when fixed-sized and content-based columns/rows have taken their space.
  • 42. Bye bye Bootstrap, bye bye Foundation...
  • 43. ONE MORE FUNNY THING… OVERLAP
  • 44. A B C D F G E control overlaps with z-index
  • 45. NEXT STEP: NESTED GRIDS Header SUB-GRID SUB-GRID CONTENT SUB-GRID FOOTER SUB-GRID SIDEBAR Primary sidebar Secondary sidebar Footer Outer grid contains another grid defined by display: grid property. Nested grid is independent by parent.
  • 46. Nested grids can't inherit column widths from the parent. . . . grid: subgrid can do it but actually is not supported by browsers. Subgird feature is at-risk and may be dropped during the CR period.
  • 47. RESPONSIVE DESIGN CSS grids can be fully managed inside media queries: you have great control and unbelievable possibilities for web layouts. Redefine elements position and size is very easy. If you want you could also redefine your grid.
  • 50. CSS GRID LAYOUT + FLEXBOX
  • 51. Grid is the best for complex page layouts Grid is two-dimensional and supports non-linear design Flexbox is the ideal solution for small page components Flexbox is one-dimensional and supports linear design; remember that it works on axis (column and row direction).
  • 52. CSS Grid avoids redundant markup!
  • 53. A WELL-BALANCED MIX OF GRID AND FLEX IS THE KEY OF BETTER PERFORMANCE.
  • 54. THAT'S COOL, BUT IN REALITY?
  • 55. CHROME has the most advanced implementation (Blink). SAFARI is close to Chrome implementation, prefixed -webkit on nightlies. FIREFOX is in development. IE10+ & EDGE have a working but outdated implementation. The update to current spec is high priority in backlog.
  • 56. STATE OF THE SPECIFICATION Currently Working Dra Level 1: 17 September 2015 Plans to move it forward to Last Call Working Dra before CR.
  • 57. USEFUL LINKS W3C Working Dra https://www.w3.org/TR/css-grid-1 W3C Editor's Dra https://dra s.csswg.org/css-grid-1 Polyfill (by Fremy Company) https://github.com/FremyCompany/css-grid-polyfill Codepen examples: , ,1 2 3
  • 58. ENJOY IT! Thank you ;) Characters in GIFs are of the respective owners. I'm sorry if I broke some copyright but it wasn't for commercial purposes.