This is a continuation of the things I’ve learned from Interneting is Hard. Click here and here for previous posts.
- Use
display: flex; to make a flex container in css. - Flex containers only position child elements (not grandchildren, etc).
-
flex-wrap: wrap;justify-content: center;to create divs which contents wrap when overflow
-
flex-direction: column; to change direction contents are rendered. -
order: 1; orders the items accordingly (accepts negative values)
-
align-self: flex-end; aligns the element accordingly
- flex: 1; tells the item to stretch to match the width of div (flex:2 = item stretched by ratio of 2)
flex: initialfalls back to the item’s explicitwidthproperty.- Auto-margins eat up all the extra space in a flex container, so instead of distributing items equally, this moves the rest of the items to the right side of the container.