GridBox Flashcards
(10 cards)
Grid Box Declaration
Display: grid;
Role of the ‘grid-template-columns’ property
The grid-template-columns property can also be used to specify the size (width) of the columns.
This can be specified in a variety of ways
Role of the ‘justify-content’ property in the grid
The justify-content property is used to horizontally align the whole grid inside the container.
Role of the ‘align-content’ property in the grid
The align-content property is used to vertically align the whole grid inside the container.
What is a grid ‘item’
This term refers to a DIRECT descendant of the grid container. (The item’s children are NOT items in that sense.)
What is a grid ‘area’
The total space bounded by four grid lines
How do you define the # of rows and columns in a grid?
Use the ‘grid container’ properties:
grid-template-columns and
grid-template-rows
The align-content property is used to vertically align the whole grid inside the container.
What is the syntax of the ‘repeat’ option in grid definition?
If your definition contains repeating parts, you can use the repeat() notation to streamline things:
.container {
grid-template-columns: repeat(3, 20px [col-start]);
}
Which is equivalent to this:
.container {
grid-template-columns: 20px [col-start] 20px [col-start] 20px [col-start];
}
If multiple lines share the same name, they can be referenced by their line name and count.
.item {
grid-column-start: col-start 2;
}
What is the syntax of the ‘fr’ unit?
The fr unit allows you to set the size of a track as a fraction of the free space of the grid container. For example, this will set each item to one third the width of the grid container:
.container {
grid-template-columns: 1fr 1fr 1fr;
}
The free space is calculated after any non-flexible items. In this example the total amount of free space available to the fr units doesn’t include the 50px:
.container {
grid-template-columns: 1fr 50px 1fr 1fr;
}
What is the proper syntax for the name grid area command?
grid-area
Gives an ITEM a name so that it can be referenced by a template created with the grid-template-areas property. Alternatively, this property can be used as an even shorter shorthand for grid-row-start + grid-column-start + grid-row-end + grid-column-end.
Values:
– a name of your choosing / / / – can be numbers or named lines
.item {
grid-area: | / / / ;
}