CSS Grid Flashcards
grid-template-areas
Allows you to name sections of your web page to use as values in the grid-row-start, grid-row-end, grid-column-start,grid-column-end, and grid-area properties.
Where is grid-template-areas declared?
This property is declared on grid containers.
What property do you use to overlap elements?
When overlapping elements, it is generally easiest to use the grid-area property with grid row names. Remember that grid-area will set the starting and ending positions for both the rows and columns of an item.
What are the 2 axes in a grid layout?
The column (or block) axis and the row (or inline) axis.
What does the column axis do in CSS grid?
The column axis stretches from top to bottom across the web page.
What does the row axis do in CSS grid?
The row axis stretches from left to right across the web page.
justify-items
A property that positions grid items along the inline, or row, axis. This means that it positions items from left to right across the web page.
Where is justify-items declared?
This property is declared on grid containers.
What are the available values for justify-items?
start
end
center
stretch
justify-items: start;
Aligns grid items to the left side of the grid area
justify-items: end;
Aligns grid items to the right side of the grid area
justify-items: center;
Aligns grid items to the center of the grid area
justify-items: stretch;
Stretches all items to fill the grid area
justify-content
We can use justify-content to position the entire grid along the row axis.
Where is justify-content declared?
This property is declared on grid containers.
What are the available values for justify-content?
start
end
center
stretch
space-around
space-between
space-evenly
NOTE: There are several other values that justify-content accepts, which you can read about on the Mozilla Developer Network.
justify-content: start;
Aligns the grid to the left side of the grid container
justify-content: end;
Aligns the grid to the right side of the grid container
justify-content: center;
Centers the grid horizontally in the grid container
justify-content: stretch;
Stretches the grid items to increase the size of the grid to expand horizontally across the container
justify-content: space-around;
Includes an equal amount of space on each side of a grid element, resulting in double the amount of space between elements as there is before the first and after the last element
justify-content: space-between;
Includes an equal amount of space between grid items and no space at either end
justify-content: space-evenly;
Places an even amount of space between grid items and at either end
align-items
A property that positions grid items along the block, or column axis. This means that it positions items from top to bottom.
Where is align-items declared?
This property is declared on grid containers.
What are the available values for align-items?
start
end
center
stretch
NOTE: There are several other values that align-items accepts, which you can read about on the Mozilla Developer Network.
align-items: start;
Aligns grid items to the top side of the grid area