Flexbox Flashcards
What is flexbox?
It is a group of items in a row or column.
display: flex; or display: inline-flex;
How do you set the flexbox to go down?
flex-direction: column;
Container or child? What does it do and how do you use it?
flex-direction?
Container. flex-direction: row;
There are also column, row-reverse, column-reverse
Container or child? What does it do and how do you use it?
flex-basis?
Container. It sets the size of each item in the flexbox.
flex-basis: 100px;
It is linked to the flex-direction. If -row then flex-basis is the width, If -column then flex-basis is the height.
What is justify-content? What are it’s values?
justify-content determines how the “boxes” appear in the container they are in.
JC’s safe values are flex-start, flex-end, center.
Other values like space-between are not used in all browsers
Container or child? What does it do and how do you use it?
flex-wrap:
Container. It allows boxes to wrap to the next line when the screen gets too narrow.
nowrap is default, wrap will wrap
Container or child? What does it do and how do you use it?
order:
Child. You can move the boxes around on the screen. lowest order number to the left.
Container or child? What does it do and how do you use it?
justify-content:
Container. flex-start is default and starts at the left edge and goes along the main-axis.
flex-end will start at the right side of the page.
center will center the boxes.
Container or child? What does it do and how do you use it?
align-items
Container. This aligns the items along the cross axis. ie.. if flex-direction is row, align-items goes from top to bottom.
In “height: 70vh;” what does vh stand for and why would you use it?
viewport height. it is the size of the container along the cross axis.
Container or child? What does it do and how do you use it?
align-self
Child.
Container or child? What does it do and how do you use it?
align-content
Container. This only works when flex-wrap is set to wrap.
Container or child? What does it do and how do you use it?
flex-grow and flex-shrink
Container. default, shrink is on and grow is off.
flex-shrink: 1;