CSS Grid Flashcards
How to make any element into a css grid?
display: grid;
grid-template-columns:
a property that indicates the number of columns in the grid, and the value of each parameter indicates the width of each column.
grid-template-rows:
used to adjust the amount and width of rows
CSS Grid units:
fr: sets the column or row to a fraction of the available space.
auto: sets the column or row to the width or height of its content automatically
%: adjusts the column or row to the percent width of its container
grid-column-gap:
Used to add gaps between columns.
grid-row-gap:
Used to add gaps in between rows.
grid-gap
Short hand for grid-row/column-gap. If grid-gap has one value it will create a gap between all rows and columns; if there are two values, it will use the first one to set gaps for the rows and the second for columns.
grid-column:
a property used to control the amount of columns an item will consume.
(ex: grid column: 1 / 3;
this will make the item start at the first vertical line on the lift and span to the third, consuming two columns.)
grid-row:
a property used to control the amount of rows an item will consume.
justify-self:
A property used to align the content’s position within a cell, horizontally.
justify-self: start;
aligns the content at the left of the cell.
justify-self: stretch;
will make the content fill the whole width of the cell.
justify-self: center;
aligns the content in the center of the cell.
justify-self: end;
aligns the content at the right of the cell.
Cell
The content of each item is located in a box known as the grid.