Making A Website Responsive - Learn CSS - Grid Cheatsheet - Codecademy
Making A Website Responsive - Learn CSS - Grid Cheatsheet - Codecademy
fr Relative Unit
.grid {
display: grid;
width: 100px;
grid-template-columns: 1fr 60px 1fr;
}
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 1/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
Grid Gap
The CSS grid-gap property is a shorthand way of // The distance between rows is 20px
setting the two properties grid-row-gap and grid-
// The distance between columns is 10px
column-gap . It is used to determine the size of the
gap between each row and each column. The first value
sets the size of the gap between rows and while the #grid-container {
second value sets the size of the gap between columns.
display: grid;
grid-gap: 20px 10px;
}
CSS grid-row
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 2/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
minmax() Function
The CSS Grid minmax() function accepts two /* In this example, the second column
parameters:
will vary in size between 100px and 500px
The first parameter is the minimum size of a row
or column. depending on the size of the web browser"
The second parameter is the maximum size. */
The grid must have a variable width for the minmax()
function.
If the maximum value is less than the minimum, then .grid {
the maximum value is ignored and only the minimum display: grid;
value is used.
grid-template-columns: 100px
The function can be used in the values of the grid-
template-rows , grid-template-columns and grid- minmax(100px, 500px) 100px;
template properties. }
CSS grid-row-gap
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 3/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
CSS grid-area
Justify Items
Align Self
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 4/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
CSS grid-template-areas
The CSS grid-template-areas property allows the /* Specify two rows, where "item" spans
naming of sections of a webpage to use as values in the
the first two columns in the first two
grid-row-start , grid-row-end , grid-column-start ,
grid-column-end , and grid-area properties. They rows (in a four column grid layout)*/
specify named grid areas within a CSS grid. .item {
grid-area: nav;
}
.grid-container {
display: grid;
grid-template-areas:
'nav nav . .'
'nav nav . .';
}
CSS grid-auto-flow
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 5/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
Justify Content
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 6/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
Align Content
CSS grid-auto-rows
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 7/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
Justify Self
The CSS justify-self property is used to set how an // The grid items are positioned to the
individual grid item positions itself along the row or
right (end) of the row.
inline axis. By default grid items inherit the value of the
justify-items property on the container. So if the
justify-self value is set, it would over-ride the #grid-container {
inherited justify-items value.
display: grid;
The value start positions grid items on the left side of
justify-items: start;
the grid area.
The value end positions the grid items on the right }
side of the grid area.
The value center positions grid items on the center of
.grid-items {
the grid area.
The value stretch positions grid items to fill the grid justify-self: end;
area (default). }
CSS grid-area
Align Items
Print Share
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 8/9
12/26/23, 11:02 AM Making a Website Responsive: Learn CSS: Grid Cheatsheet | Codecademy
0
https://www.codecademy.com/learn/fscj-22-making-a-website-responsive/modules/wdcp-22-learn-css-grid-549234ef-7622-479b-8d5d-0b4c91998… 9/9