CSS Grid Flashcards
Turn a div into a grid container
display: grid
What property specifies column widths?
grid-template-columns: 100px 600px 300px
How can you name a column?
grid-template-columns: [column-name] 1fr [column-name] 2fr … (Each side of a column can only have one name)
What property creates modules for “modular” layouts?
grid-template-area
Use modular layout property to make title span top and a sidebar and main area below
grid-template-area:
“title title”
“sidebar main”
Create 3 rows with equal heights
grid-template-rows: 1fr 1fr 1fr
What’s shorthand for having a column extend from column 1 to column 4?
grid-column: 1 / 4 (or use named columns) Also, grid-template-area might be a better way to handle this situation.
Can you name grid-template-columns with multiple names?
No, but you can use names in multiple ways:
[a-start] 1f [b-start] 1fr [b-end] 1f [a-end];
.grid-item { grid-column: a/b; // on left
.grid-item { grid-column: c/c; // on right
.grid-item { grid-column: a; // full width