Grid is used for making complex web design layouts more easily as it's not so hard to master
Using Flex you can make only 1D layout but Grid gives you the full power of creating a 2D layout
Let's start
{ 02 / 28 }
Using Flex you can make only 1D layout but Grid gives you the full power of creating a 2D layout
Let's start
{ 02 / 28 }
Nothing will change after adding display: flex; in the parent container because we need to define the width of columns. In order to set that column's width we have gird-template-columns property.
{ 04 / 28 }
{ 04 / 28 }
Alright moving forward, The next property we have is `grid-template-areas` which specifies the areas within the grid layout.
Each row is defined by apostrophes (' ')
Sounds confusing? Let see this in action
{ 16 / 28 }
Each row is defined by apostrophes (' ')
Sounds confusing? Let see this in action
{ 16 / 28 }
Now let's apply this area (areaName) to the first grid item
.one {
grid-area: areaName;
}
As you can see item1 takes one entire row and 5 columns. As simple as that
codepen.io
{ 18 / 28 }
.one {
grid-area: areaName;
}
As you can see item1 takes one entire row and 5 columns. As simple as that
codepen.io
{ 18 / 28 }
Alright, moving further let's talk about in the context of Grid items.
We can set the ordering and alignment of a particular item. Let's dive into it
{ 19 / 28 }
We can set the ordering and alignment of a particular item. Let's dive into it
{ 19 / 28 }
š The Order of the items
The order is nothing but used to set the order of an item within the grid container
{ 20 / 28 }
The order is nothing but used to set the order of an item within the grid container
{ 20 / 28 }
š Alignment in CSS Grid Layout
This is a little confusing thing but we will cover everything in this thread.
justify-content
align-items
justify-self
align-self
{ 22 / 28 }
This is a little confusing thing but we will cover everything in this thread.
justify-content
align-items
justify-self
align-self
{ 22 / 28 }
The `justify-content` is used to align the container's items when the items do not use all available space on the main-axis (horizontally).
š w3schools.com
{ 23 / 28 }
š w3schools.com
{ 23 / 28 }
The `align-items` property specifies the default alignment for items inside the flexible container.
š w3schools.com
{ 24 / 28 }
š w3schools.com
{ 24 / 28 }
Try to play around with code here. This might be a little confusing in the beginning but once you get used to it, it all becomes pretty easy
codepen.io
{ 27 / 28 }
codepen.io
{ 27 / 28 }
I think that's pretty much it, If you like this thread share it with your connections ā¤ļø
Peace out š
{ 28 / 28 }
Peace out š
{ 28 / 28 }
Loading suggestions...