Flexbox allows you to create fluid layouts easily. If you find yourself constantly looking up the syntax or how it work, this handy cheatsheet is all you need.
display: flex or display: inline-flex: creates a flex context (or an inline flex context) for direct children of this elementflex-direction determines the main and cross axis for the container, valid values are:row (default): horizontal, in the direction of writing (left to right for English)row-reverse: horizontal, in the opposite direction of writing (right to left for English)column: vertical, top to bottomcolumn-reverse: vertical, bottom to topflex-wrap determines if flex items will try to fit in one line, valid values are:nowrap (default): all flex items will be on one linewrap: flex items will wrap onto multiple lines, top to bottomwrap-reverse: flex items will wrap onto multiple lines, bottom to topflex-flow: shorthand combining flex-direction and flex-wrapflex-flow: <'flex-direction'> || <'flex-wrap'>justify-content defines the alignment along the main axis, valid values are:flex-start (default): pack flex items from the startflex-end: pack flex items from the endstart: pack items from the startend: pack items from the endleft: pack items from the leftright: pack items from the rightcenter: pack items around the centerspace-around: distribute items evenly with equal space around themspace-between: distribute items evenly with equal space between themspace-evenly: distribute items evenly, ensuring equal space between any two itemsstretch: distribute items evenly, stretching auto-sized items to fit the containeralign-items defines the alignment along the cross axis, valid values are:flex-start (default): pack flex items from the startflex-end: pack flex items from the endstart: pack items from the startend: pack items from the endcenter: pack items around the centerbaseline: align items based on their baselinesstretch: stretch items to fill the containeralign-content defines the alignment of extra space along the cross axis, valid values are:flex-start (default): pack flex items from the startflex-end: pack flex items from the endstart: pack items from the startend: pack items from the endcenter: pack items around the centerspace-around: distribute items evenly with equal space around themspace-between: distribute items evenly with equal space between themspace-evenly: distribute items evenly, ensuring equal space between any two itemsstretch: distribute items evenly, stretching auto-sized items to fit the container
Items
flex-grow determines how much the item can grow if necessary0flex-grow, all items will receive an equal share of the remaining spaceflex-grow, the remaining space is distributed according to the ratio defined by these valuesflex-shrink determines how much the items can shrink if necessary1flex-shrinkflex-basis determines the initial size of a flex item before the remaining space is distributedwidth value, intrinsic size values, auto (default) or contentauto means "look at my width or height property", whereas content is used for automatic sizingflex: shorthand combining flex-grow, flex-shrink and flex-basisflex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]align-self allows the item to override the default align-items specified by the containeralign-items property in the containerorder determines the ordering of the itemorder value and then by their source code order Ⓒ Repository by
Code Honchos