Section 10 - Grid Flashcards
What is the CSS Grid system?
a 2D layout system
Flexbox is a great tool to align content in what way?
Helps align content along a 1D line (horizontal or vertical)
———>
Grid is a great tool to align content for what layouts?
Great for 2D layouts where you have a table structure with columns and rows
What does 2D mean?
That there is an X and a Y axis
If there’s an X and a Y axis, in most cases you’re better off using what?
(2D) Grid
You should only use either Flexbox or Grid. T or F?
False, most developers use both tools alongside others (floats, bootstraps, frameworks to create a design)
Within a Grid you can have a container laid out using Flexbox (3 horizontal divs within a Grid container). T or F?
True
(This is really common)
Having multiple divs in a Flexbox column (inside a grid container) is a really good way of setting the ______
alignment for each of the items
Web page: Weather
Grid Container: Degrees
Flexbox column: Weather Summary, Town, City, Feels Like, Postal Code
In terms of lining up items and gaps, which layout tends to match up with each other?
Grid
(Flexbox is hard to get the items to line up)
How do you create a Grid? (4 steps)
- Create a “parent” div container with a class (with elements inside, like paragraphs) in index.html
- Target the parent container class in styles.css, add display: grid
- Add grid-template-columns and grid-template-rows 1fr 2fr;
- Add a gap if needed for between columns and rows
With divs, for them to show up from invisible you need to set what 2 things?
- Background color
- Height/Width
How many “fr” do you add to your grid-template-columns and rows line?
Depending on how many columns (or rows) you need. One “fr” for every column.
(stands for fraction)
What’s the default layout of the HTML flow?
The new item sits below the last item to create a column
All divs are set as display: block so they’re going to do what?
they’re going to try to occupy the full width of the screen by default
When a container tries to take up the full width of the screen, it can create ____
gaps between items