Flexbox Flashcards
How do we turn an element into a flexbox container?
We set its display property to flex.
What is the default direction for a flex container?
The default direction is row.
How do we change the direction of our flexbox?
flex-direction: value
What is the default width for the direct children of a flexbox container?
Direct children will attempt to be as small as they can be to contain their content.
What is the element with display: flex; called
It is called the flex container
What are the direct children of a flex container called?
They are called flex items
Can flex items overflow their flex container?
Yes, if there is not enough space to hold the flex items, they will overflow their flex container and will cause a horizontal scroll.
What is the default behavior for flex-wrap in a flex container?
The default is flex-wrap: nowrap;
How can we increase the space between flex-items?
We can use gap.
How could we use a combinator to increase space between flex items?
We could use the adjacent sibling combinator and select our flex items.
.col + .col
and then introduce a margin-left: declaration to space them
How tall will flexbox items become by default.
Flexbox items will stretch along the row to equal the height of the tallest column content.
How could we prevent an image from stretching when we place it in a flexbox row?
Would could set the align-self property to flex-start
align-self: flex-start;
What justify property is available to use in Flexbox?
Flexbox uses the justify-content property on the flex-container.
What does the justify-content property control in flexbox?
The justify-content property controls how flex items are spaced along the main axis.
Can we set widths to flex items?
Yes, although we should:
- set them in percentages
- have the total percentages equal < 100%