6. More CSS Flashcards
____ is a CSS layout mode that provides an efficient way to lay out elements in a container so the elements behave predictably when the container is resized or viewed on different screen sizes.
Flexbox
A flex container is an element that has the CSS property ____ set to ____ to create a block-level flex container or ____ to create an inline flex container
display, flex, inline-flex
A ____ is a child element of a flex container that is positioned and sized according to various CSS flexbox properties
flex item
The ____ property defines the direction of flex items within the container using values
flex-direction
What are the different values for the flex-direction property?
row
row-reverse
column
column-reverse
The ____ property defines the space between flex items.
gap
gap: 10px;
The ____ property justifies the flex items within the container using values
justify-content
What are the different values for the justify-content property?
flex-start
flex-end
center
space-between
space-around
space-evenly
The ____ property determines if or how flex items wrap onto multiple rows when the container is not wide enough to hold all items
flex-wrap
What are the different values for the flex-wrap property?
nowrap (default)
wrap
wrap-reverse
A flex item’s width is determined by the combination of what three properties?
flex-basis
flex-grow
flex-shrink
What does flex-basis do, and what values can it be set to?
The flex-basis property sets the initial length of a flex item. The values can be auto (the default), a percentage, or a length unit. The default value auto makes the flex item the same initial length as the content
What does the flex-grow property do, and what values can it be set to?
The flex-grow property sets a proportion that determines how much of the available container space should be assigned to the item. The default is 0, meaning the size should be based on the item’s content
The flex-grow property can also be set to 1, 2, 3, 4, etc., which means that the element will grow to the indicated proportion relative to other elements in the container
The different flex-grow values of all of the elements in a container establish a ratio for each element’s size
What does the flex-shrink property do, and what values can it be set to?
The flex-shrink property sets a proportion that determines the item’s minimum size. The default is 1, meaning the size should shrink at the same rate as other items when the container width shrinks. A value of 0 means the item should not change sizes when the container width shrinks
If one element in a container has a flex-shrink value of 2, and another has a flex-shrink value of 1, the first element will shrink twice as much as the second
The shorthand ____ property establishes the ____, ____, and ____ properties, in that order, for flex items
flex, flex-grow, flex-shrink, flex-basis
____ layout is a CSS layout mode that divides a webpage into a rectangular grid in which to position page elements. Grid layout is ideal for designing two-dimensional webpage layouts.
Grid
A(n) grid ____ is an element that has the CSS property display set to “____” to create a block-level grid container or “____” to create an inline grid container
container, grid, inline-grid
A grid ____ is a child element of a grid container that is by default placed into a single grid cell.
item
The ____ property defines the grid container’s number of columns and optionally the width of each column.
grid-template-columns
grid-template-columns: 50px 90px auto auto;
This specifies 4 values that create 4 columns: the first is 50px wide, the second is 90px wide, and the third and fourth columns are automatically sized to fit the remainder of the grid width
What does the gap property do in the grid layout?
It determines how much space should go between rows and columns.
gap: 5px 25px;
This puts a gap of 5px between rows and 25px between columns
What property do you use to determine the row height in a grid?
grid-template-rows
grid-template-rows: 20px 40px;
This makes the first row 20px tall and the second row 40px tall
What are the different values for the justify-content
and align-content
property with grids?
start
- Aligns grid flush with the grid container’s starting edge
end
- Aligns grid flush with the grid container’s ending edge
center
- Aligns grid in the center of the grid container
stretch
- Stretches the grid items to fill the grid container width
space-around
- Places equal spacing between grid items with half the space on either side of the grid container
space-between
- Places equal spacing between grid items with no space on either side of the grid container
space-evenly
- Places equal spacing between grid items, including the sides of the grid container
What does the following grid property and value mean?
grid-row: 1 / 3;
The grid item starts in row line 1 and ends in row line 3 of the grid.
What does the following grid property and value mean?
grid-column: 1 / 4;
The grid item starts in column line 1 and ends in column line 4 of the grid.
What does the following grid property and value mean?
grid-area: 1 / 2 / 3 / 4;
The grid item starts in row line 1 and column line 2 and ends in row line 3 and column line 4
What property can you use to name grid items?
You can use the grid-area
property.
```
body {
grid-template-areas: “head head head”;
}
header {
grid-area: head;
}
~~~
What character can you use in the grid-template-areas
property to represent an empty grid cell?
A period (.)
What are the four different values that the position
property can use?
static
- the default positioning
relative
- positions the element relative to the element’s default position
fixed
- positions the element relative to the viewport in a fixed location
absolute
- positions the element relative to the nearest positioned ancestor