Flexbox
Flexbox can do stuff like same size box and pop things up and down and navigation changes position. Flexbox default has next line be longer and can have empty boxes, if you dont want that then grid
Basic Steps
Add
display: flex;
to the parent of elementsSet
flex-direction
tocolumn
orrow
Components
Creation - display
Direction: flex-flow(row/column & wrapping) (flex-direction, flex-wrap)
Alignment: justify-content, align-items, align-self, align-content
Ordering: order
Flexibility: flex(flex-grow, flex-shrink, flex-basis) change proportional to other shit
Display
flex: (can it grow) (can it shrink)
Definitions
Flex-Item is all none-absolute child of display: flex
main axis is like along one row is direciton is row
cross axis is perpedential to main axis
Impacted CSS Properties
ignore column, float, clear, vertical-align
Change minwidth&height default is auto not 0
Change visibility to collapse
Change margin:
Flex Container
Flex-direction
Row is like in 1 row: a | b | c
row(default)
row-reverse
column
Column-reverse
Special Cases:
Reverse actually doesn't change order for screen readers
Change languages to right to left changes order of columns or rows
SO, have flex column of nav bar, main page, and footer, then in main page have flex row, in each flex row have flex columns etc etc...
Flex-wrap
nowrap(default)
wrap
wrap-reverse(changes cross axis direction)
Flex-flow
shorthand for wrap&dir
Styles on Parent
Justify-content
Aligns flex items along the main axis if sum of flex items doesn't equal container
Flex-start(group at main-start)
Flex-end(group at main-end)
center(group at center)
space-between(put 1st and last in place and everything evently spaced)
space-around(same margin of space around each item)
Space-evenly(same amount of space between each item)
Align-content
Only applies to organization of multiple-line stuff along cross axis, how each line is displayed
Align-items
align flex items along cross axis within line
flex-start(group at cross-start)
flex-end(group at cross-end)
center(center of max)
baseline(header bottom all perfectly aligned)
stretch(every item stretchs to max)
Styles on Flex Items
Align-self
Override align item for an individual item, same properities
auto is new prop that means what parents says to do
Order
default value is 0, depending on given values organizes in ascending order -1 0 1 where 0 is done by markup
Flexibility
Grow shrink and be the right size
Make overflow-hidden
to stop the contents from affecting the min size
Flex is shorthand, but made up of
flex-grow: how to divide extra space, given to anything with value greater than 0 proportionally on this value(default: 1)
Flex-shrink: how to shrink if there's not enough room, shrink based on this value(default: 1)
Flex-basis: the starting size before free space is distributed; length value(px, em), content, or auto; 0 divides all space, auto depends on content
Will never shrink to less than longest word
Center Something
Last updated