SlideShare a Scribd company logo
CSS GRID LAYOUT
A S H O R T I N T R O D U C T I O N – PA R T 1
WHAT IS IT?
• CSS Grid Layout introduces a two-dimensional grid system to CSS. Grids can be used
to layout major page areas or small user interface elements.
• A grid is an intersecting set of horizontal and vertical lines – one set defining columns
and the other rows. Elements can be placed onto the grid, respecting these column
and row lines.
• CSS Grid can handle both columns and rows, unlike flexbox which is largely a 1-
dimensional system.
FEATURES
• You can create a grid with fixed columns and rows sizes – using pixels or flexible sizes
with percentages or with the new fr unit designed for this purpose.
• You can place items into a precise location on the grid using line numbers, names or
by targeting an area of the grid. Grid also contains an algorithm to control the
placement of items not given an explicit position on the grid.
• Grid contains alignment features so that we can control how the items align once
placed into a grid area, and how the entire grid is aligned.
A BIT OF HISTORY
• CSS has always been used to lay out our web pages, but it's never done a very good
job of it.
• First, we used tables, then floats, positioning and inline-block, but all of these methods
were essentially hacks and left out a lot of important functionality (vertical centering,
for instance).
• Flexbox helped out, but it's intended for simpler one-dimensional layouts, not complex
two-dimensional ones (Flexbox and Grid actually work very well together).
• Grid is the very first CSS module created specifically to solve the layout problems we've
all been hacking our way around for as long as we've been making websites.
• The beginnings of CSS Grid date back to 2011 and a proposal sent to the CSS Working
Group from Microsoft.
• On October 2017, Microsoft’s Edge browser shipped its implementation of CSS Grid. It
means that all major browsers now support this layout tool. All major browsers rolled
out their implementations in a single year.
BROWSER SUPPORT
* Partial support in IE10 & IE11 with prefix -ms-. It's an old implementation with an
outdated syntax.
TERMINOLOGY
• Grid Container
• Grid Item
• Grid Tracks
• Grid Cell
• Grid Area
• Grid Line
• Gutters
• Fraction Unit
• Implicit/Explicit Grid
GRID CONTAINER
• The element on which display: grid is applied. It's the direct parent of all the grid
items. In this example container is the grid container.
GRID ITEM
• The children (e.g. direct descendants) of the grid container. Here the item elements are
grid items, but sub-item isn't.
GRID TRACKS
• We define rows and columns on with the grid-template-columns and grid-template-
rows properties. These define grid tracks. A grid track is the space between any two
lines on the grid.
GRID CELL
• The space between two adjacent row and two adjacent column grid lines. It's a single
"unit" of the grid.
GRID AREA
• The total space surrounded by four grid lines. A grid area may be comprised of any
number of grid cells. Items can span one or more cells both by row or by column.
• Grid areas must be rectangular – it isn’t possible to create an L-shaped area for
example.
GRID LINE
• The dividing lines that make up the structure of the grid. They can be either vertical
("column grid lines") or horizontal ("row grid lines") and reside on either side of a row
or column.
1
2
3
4
1 2 3 4
1
2
3
4
1 2 3 4
2nd Row
Line
3rd Column
Line
GUTTERS
• Gutters between grid cells can be created using the column-gap and row-gap properties,
or the shorthand gap which takes row-gap and column-gap
• They only appear between tracks of the implicit grid; there is no gutter before the first
track or after the last track.
REPEAT FUNCTION
• Large grids with many tracks can use the repeat() notation, to repeat all or a section of the
track listing.
grid-template-columns: 100px 100px 100px;
===
grid-template-columns: repeat(3, 100px);
grid-template-columns: 100px 200px 100px 200px;
===
grid-template-columns: repeat(2, 100px 200px);
FRACTION UNIT
• Tracks can be defined using any length unit (pixels, percentages, em etc…)
• The fr unit allows you to set the size of a track as a fraction of the free space of the
grid container.
IMPLICIT AND EXPLICIT GRID
• We defined our column tracks with the grid-template-columns property, but the grid
also created rows on its own. These rows are part of the implicit grid.
• Whereas the explicit grid consists of any rows and columns defined with grid-
template-columns or grid-template-rows.
GRID ALIGNMENT
• Sometimes the total size of your grid might be less than the size of its grid container.
This could happen if all of your grid items are sized with non-flexible units like px
• In this case you can set the alignment of the grid within the grid container.
• justify-content aligns the grid along the inline (row) axis
• align-content aligns the grid along the block (column) axis
JUSTIFY-CONTENT
start end center stretch
space-around space-between space-evenly
ALIGN-CONTENT
start end center stretch
space-around space-between space-evenly
MINMAX
• Defines a size range for tracks
• Takes two parameters, min and max
• They can be pixels, percentages, fr, max-content and min-content
• max-content – doesn‘t break the content
• min-content – breaks the content
WHAT’S NEXT?
• Grid areas
• Aligning grid items in a grid
• Aligning grid items inside cells
• How to control implicit grid tracks
• How to control auto-placement algorithm
• Animating grid properties
• How to deal with IE
RESOURCES
• CSS Grid Layout Module Level 1 Editor’s Draft
• The Story of CSS Grid, from Its Creators
• Microsoft’s initial proposal of the grid
• Basic concepts of grid layout
• A Complete Guide to Grid
• CSS Grid Layout Support
• How the minmax function works
Ad

More Related Content

What's hot (20)

The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSS
Rachel Andrew
 
Introduction to CSS Grid Layout
Introduction to CSS Grid LayoutIntroduction to CSS Grid Layout
Introduction to CSS Grid Layout
Rachel Andrew
 
Future Layout & Performance
Future Layout & PerformanceFuture Layout & Performance
Future Layout & Performance
Rachel Andrew
 
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
Rachel 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 2016
Rachel Andrew
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
Rachel Andrew
 
Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid Layout
Rachel 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 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 SF
Rachel 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
 
Devoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid LayoutDevoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid Layout
Rachel Andrew
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
Rachel 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 Layout
Rachel 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 Layout
Rachel Andrew
 
But what about old browsers?
But what about old browsers?But what about old browsers?
But what about old browsers?
Rachel Andrew
 
CSS Grid Layout - All Things Open
CSS Grid Layout - All Things OpenCSS Grid Layout - All Things Open
CSS Grid Layout - All Things Open
Rachel 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 Layout
Rachel Andrew
 
CSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS LayoutCSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS Layout
Rachel Andrew
 
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
Rachel 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 2017
Morten Rand-Hendriksen
 
The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSS
Rachel Andrew
 
Introduction to CSS Grid Layout
Introduction to CSS Grid LayoutIntroduction to CSS Grid Layout
Introduction to CSS Grid Layout
Rachel Andrew
 
Future Layout & Performance
Future Layout & PerformanceFuture Layout & Performance
Future Layout & Performance
Rachel Andrew
 
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
Rachel 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 2016
Rachel Andrew
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
Rachel Andrew
 
Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid Layout
Rachel 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 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 SF
Rachel 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
 
Devoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid LayoutDevoxx Belgium: CSS Grid Layout
Devoxx Belgium: CSS Grid Layout
Rachel Andrew
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
Rachel 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 Layout
Rachel 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 Layout
Rachel Andrew
 
But what about old browsers?
But what about old browsers?But what about old browsers?
But what about old browsers?
Rachel Andrew
 
CSS Grid Layout - All Things Open
CSS Grid Layout - All Things OpenCSS Grid Layout - All Things Open
CSS Grid Layout - All Things Open
Rachel 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 Layout
Rachel Andrew
 
CSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS LayoutCSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS Layout
Rachel Andrew
 
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
Rachel 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 2017
Morten Rand-Hendriksen
 

Similar to Css Grid Layout - A Short Introduction - Part 1 (20)

Flexbox, Grid and Sass
Flexbox, Grid and SassFlexbox, Grid and Sass
Flexbox, Grid and Sass
Seble Nigussie
 
The Grid - The Future of CSS Layout
The Grid - The Future of CSS LayoutThe Grid - The Future of CSS Layout
The Grid - The Future of CSS Layout
Ronny Siikaluoma
 
MTA css layouts
MTA css layoutsMTA css layouts
MTA css layouts
Dhairya Joshi
 
CSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzCSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, Linz
Rachel Andrew
 
Vector data model
Vector data model Vector data model
Vector data model
PRAMODA G
 
Vector data model
Vector data modelVector data model
Vector data model
PRAMODA G
 
JavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy FowlerJavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy Fowler
Stephen Chin
 
Grid system introduction
Grid system introductionGrid system introduction
Grid system introduction
ananda gunadharma
 
Bootstrap SLIDES for web development course
Bootstrap SLIDES for web development courseBootstrap SLIDES for web development course
Bootstrap SLIDES for web development course
dreamy678
 
Bootstrap ppt
Bootstrap pptBootstrap ppt
Bootstrap ppt
Nidhi mishra
 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid Layout
Rachel Andrew
 
What is grid system
What is grid systemWhat is grid system
What is grid system
chetankane
 
MySql
MySqlMySql
MySql
Sukrit Gupta
 
introduction of Data strutter and algirithm.pptx
introduction of Data strutter and algirithm.pptxintroduction of Data strutter and algirithm.pptx
introduction of Data strutter and algirithm.pptx
ssuser7b3003
 
17523630.ppt
17523630.ppt17523630.ppt
17523630.ppt
ssusere2bc36
 
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
1geassking
 
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
niruttisai
 
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
Rachel Andrew
 
Applied GIS - 3022.pptx
Applied GIS - 3022.pptxApplied GIS - 3022.pptx
Applied GIS - 3022.pptx
temesgenabebe1
 
Using Bootstrap to Make Accessible Front-Ends(2).pptx
Using Bootstrap to Make Accessible Front-Ends(2).pptxUsing Bootstrap to Make Accessible Front-Ends(2).pptx
Using Bootstrap to Make Accessible Front-Ends(2).pptx
viswa7417
 
Flexbox, Grid and Sass
Flexbox, Grid and SassFlexbox, Grid and Sass
Flexbox, Grid and Sass
Seble Nigussie
 
The Grid - The Future of CSS Layout
The Grid - The Future of CSS LayoutThe Grid - The Future of CSS Layout
The Grid - The Future of CSS Layout
Ronny Siikaluoma
 
CSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzCSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, Linz
Rachel Andrew
 
Vector data model
Vector data model Vector data model
Vector data model
PRAMODA G
 
Vector data model
Vector data modelVector data model
Vector data model
PRAMODA G
 
JavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy FowlerJavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy Fowler
Stephen Chin
 
Bootstrap SLIDES for web development course
Bootstrap SLIDES for web development courseBootstrap SLIDES for web development course
Bootstrap SLIDES for web development course
dreamy678
 
What is grid system
What is grid systemWhat is grid system
What is grid system
chetankane
 
introduction of Data strutter and algirithm.pptx
introduction of Data strutter and algirithm.pptxintroduction of Data strutter and algirithm.pptx
introduction of Data strutter and algirithm.pptx
ssuser7b3003
 
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
Rachel Andrew
 
Applied GIS - 3022.pptx
Applied GIS - 3022.pptxApplied GIS - 3022.pptx
Applied GIS - 3022.pptx
temesgenabebe1
 
Using Bootstrap to Make Accessible Front-Ends(2).pptx
Using Bootstrap to Make Accessible Front-Ends(2).pptxUsing Bootstrap to Make Accessible Front-Ends(2).pptx
Using Bootstrap to Make Accessible Front-Ends(2).pptx
viswa7417
 
Ad

Recently uploaded (20)

machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
The Future of Cisco Cloud Security: Innovations and AI Integration
The Future of Cisco Cloud Security: Innovations and AI IntegrationThe Future of Cisco Cloud Security: Innovations and AI Integration
The Future of Cisco Cloud Security: Innovations and AI Integration
Re-solution Data Ltd
 
The Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdfThe Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdf
Precisely
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Does Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should KnowDoes Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should Know
Pornify CC
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
The Future of Cisco Cloud Security: Innovations and AI Integration
The Future of Cisco Cloud Security: Innovations and AI IntegrationThe Future of Cisco Cloud Security: Innovations and AI Integration
The Future of Cisco Cloud Security: Innovations and AI Integration
Re-solution Data Ltd
 
The Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdfThe Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdf
Precisely
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Does Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should KnowDoes Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should Know
Pornify CC
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Ad

Css Grid Layout - A Short Introduction - Part 1

  • 1. CSS GRID LAYOUT A S H O R T I N T R O D U C T I O N – PA R T 1
  • 2. WHAT IS IT? • CSS Grid Layout introduces a two-dimensional grid system to CSS. Grids can be used to layout major page areas or small user interface elements. • A grid is an intersecting set of horizontal and vertical lines – one set defining columns and the other rows. Elements can be placed onto the grid, respecting these column and row lines. • CSS Grid can handle both columns and rows, unlike flexbox which is largely a 1- dimensional system.
  • 3. FEATURES • You can create a grid with fixed columns and rows sizes – using pixels or flexible sizes with percentages or with the new fr unit designed for this purpose. • You can place items into a precise location on the grid using line numbers, names or by targeting an area of the grid. Grid also contains an algorithm to control the placement of items not given an explicit position on the grid. • Grid contains alignment features so that we can control how the items align once placed into a grid area, and how the entire grid is aligned.
  • 4. A BIT OF HISTORY • CSS has always been used to lay out our web pages, but it's never done a very good job of it. • First, we used tables, then floats, positioning and inline-block, but all of these methods were essentially hacks and left out a lot of important functionality (vertical centering, for instance). • Flexbox helped out, but it's intended for simpler one-dimensional layouts, not complex two-dimensional ones (Flexbox and Grid actually work very well together). • Grid is the very first CSS module created specifically to solve the layout problems we've all been hacking our way around for as long as we've been making websites. • The beginnings of CSS Grid date back to 2011 and a proposal sent to the CSS Working Group from Microsoft. • On October 2017, Microsoft’s Edge browser shipped its implementation of CSS Grid. It means that all major browsers now support this layout tool. All major browsers rolled out their implementations in a single year.
  • 5. BROWSER SUPPORT * Partial support in IE10 & IE11 with prefix -ms-. It's an old implementation with an outdated syntax.
  • 6. TERMINOLOGY • Grid Container • Grid Item • Grid Tracks • Grid Cell • Grid Area • Grid Line • Gutters • Fraction Unit • Implicit/Explicit Grid
  • 7. GRID CONTAINER • The element on which display: grid is applied. It's the direct parent of all the grid items. In this example container is the grid container.
  • 8. GRID ITEM • The children (e.g. direct descendants) of the grid container. Here the item elements are grid items, but sub-item isn't.
  • 9. GRID TRACKS • We define rows and columns on with the grid-template-columns and grid-template- rows properties. These define grid tracks. A grid track is the space between any two lines on the grid.
  • 10. GRID CELL • The space between two adjacent row and two adjacent column grid lines. It's a single "unit" of the grid.
  • 11. GRID AREA • The total space surrounded by four grid lines. A grid area may be comprised of any number of grid cells. Items can span one or more cells both by row or by column. • Grid areas must be rectangular – it isn’t possible to create an L-shaped area for example.
  • 12. GRID LINE • The dividing lines that make up the structure of the grid. They can be either vertical ("column grid lines") or horizontal ("row grid lines") and reside on either side of a row or column. 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 2nd Row Line 3rd Column Line
  • 13. GUTTERS • Gutters between grid cells can be created using the column-gap and row-gap properties, or the shorthand gap which takes row-gap and column-gap • They only appear between tracks of the implicit grid; there is no gutter before the first track or after the last track.
  • 14. REPEAT FUNCTION • Large grids with many tracks can use the repeat() notation, to repeat all or a section of the track listing. grid-template-columns: 100px 100px 100px; === grid-template-columns: repeat(3, 100px); grid-template-columns: 100px 200px 100px 200px; === grid-template-columns: repeat(2, 100px 200px);
  • 15. FRACTION UNIT • Tracks can be defined using any length unit (pixels, percentages, em etc…) • The fr unit allows you to set the size of a track as a fraction of the free space of the grid container.
  • 16. IMPLICIT AND EXPLICIT GRID • We defined our column tracks with the grid-template-columns property, but the grid also created rows on its own. These rows are part of the implicit grid. • Whereas the explicit grid consists of any rows and columns defined with grid- template-columns or grid-template-rows.
  • 17. GRID ALIGNMENT • Sometimes the total size of your grid might be less than the size of its grid container. This could happen if all of your grid items are sized with non-flexible units like px • In this case you can set the alignment of the grid within the grid container. • justify-content aligns the grid along the inline (row) axis • align-content aligns the grid along the block (column) axis
  • 18. JUSTIFY-CONTENT start end center stretch space-around space-between space-evenly
  • 19. ALIGN-CONTENT start end center stretch space-around space-between space-evenly
  • 20. MINMAX • Defines a size range for tracks • Takes two parameters, min and max • They can be pixels, percentages, fr, max-content and min-content • max-content – doesn‘t break the content • min-content – breaks the content
  • 21. WHAT’S NEXT? • Grid areas • Aligning grid items in a grid • Aligning grid items inside cells • How to control implicit grid tracks • How to control auto-placement algorithm • Animating grid properties • How to deal with IE
  • 22. RESOURCES • CSS Grid Layout Module Level 1 Editor’s Draft • The Story of CSS Grid, from Its Creators • Microsoft’s initial proposal of the grid • Basic concepts of grid layout • A Complete Guide to Grid • CSS Grid Layout Support • How the minmax function works