Flexbox & Grid Flashcards

1
Q

display: flex;

A

Placing the CSS property display: flex; on an element allows you to use other flex properties to build a responsive page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

flex-direction

A

flex-direction: row;
or
flex-direction: column;

Adding display: flex to an element turns it into a flex container. This makes it possible to align any children of that element into rows or columns. You do this by adding the flex-direction property to the parent item and setting it to row or column.

Creating a row will align the children horizontally, and creating a column will align the children vertically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

justify-content: ; property

A

Sometimes the flex items within a flex container do not fill all the space in the container. It is common to want to tell CSS how to align and space out the flex items a certain way.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

flexbox is going to get shitty

A

check the bookmark folder for the CSS flexbox graphic. it will show you how flexbox addresses sizing the x and y axis of objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

flex-wrap

A

CSS flexbox has a feature to split a flex item into multiple rows (or columns). By default, a flex container will fit all flex items together. For example, a row will all be on one line.

However, using the flex-wrap property tells CSS to wrap items.

CSS also has options for the direction of the wrap:

nowrap: this is the default setting, and does not wrap items.
wrap: wraps items onto multiple lines from top-to-bottom if they are in rows and left-to-right if they are in columns.
wrap-reverse: wraps items onto multiple lines from bottom-to-top if they are in rows and right-to-left if they are in columns.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

properties that can all be set together by using flex?

A

There is a shortcut available to set several flex properties at once. The flex-grow, flex-shrink, and flex-basis

flex: 1 0 10px;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

display: grid;

A

Turns any HTML element into a grid container by setting its display property to grid.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

To add some columns to the grid, use

A

grid-template-columns: 50px 50px;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

you add rows to the grid with

A

grid-template-row: 100px 100px;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

how do you size rows and columns in grid?

A

You can use absolute and relative units CSS Grid to define the size of rows and columns.

units like px, em, fr, auto, %

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what do fr, %, auto each do when used with css grid?

A

can set the rows or clolumns to different sizes based on:

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

add a gap in between the columns/row?

A

grid-column-gap: 10px;

grid-row-gap: 10px;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

grid-gap

A

If grid-gap has one value, it will create a gap between all rows and columns. However, if there are two values, it will use the first one to set the gap between the rows and the second value for the columns.

grid-gap: 10px 20px;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

properties not just for the grid container, but for the grid property themselves:

A

grid-column

To control the number of columns an item will consume, you can use the grid-column property in conjunction with the line numbers you want the item to start and stop at.

Here’s an example:

grid-column: 1 / 3;

This will make the item start at the first vertical line of the grid on the left and span to the 3rd line of the grid, consuming two columns.

(google css grid line numbers if this is confusing)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

whats the quicker way to create many rows and columns in CSS grid?

A

use repeat

grid-template-rows: repeat(100, 50px);

setting up repeat like above will create 100 rows, at 50px each.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what do you with the css grid function minmax?

A

t’s used to limit the size of items when the grid container changes size. To do this you need to specify the acceptable size range for your item. Here is an example:

grid-template-columns: 100px minmax(50px, 200px);

In the code above, grid-template-columns is set to create two columns; the first is 100px wide, and the second has the minimum width of 50px and the maximum width of 200px.