Fill the remaining height or width in a flex container
Easily consume the extra space in a flex container by setting flex: 1; on a child element. Whether you want to fill available height or width, set flex-direction: column; or flex-direction: row; (default) respectively on the container.
Voila! Your content is as expansive as the universe itself.
Understand your flex properties: prevention, alignment, and size
How to stop your content from shrinking
Life is too short for squished content. To maintain a steadfast width for your content, it's simple: say flex-shrink: 0; and let your box stand tall.
That's right, even in a changing container, fixed-width div will strike a pose and hold it!
Alignment: the Marie Kondo of your content
To have everything aligned just right, align-items or align-self are your magic wands.
And the award for perfect positioning goes to...
Sizing: the secret to a good fit
When dealing with size, it's important to know when to use width over flex-basis.
Understand these intricacies, and you'll achieve what every designer dreams of: predictability.
Provide priority seating to your content
Life isn't always fair. Sometimes, one element needs more space than the other ones.
Just like that, you've created a perfect balance in the force!
Dominate your flex elements: separators, robustness, and alignment
Design heart-winning separators
Often, we use grid-like layouts or separators to make our content easy on the eyes.
Just remember - creating spaces is an art!
Keep robustness in check with min-widths
Overflowing content can ruin your day faster than spilling coffee on your keyboard. min-width: 0; is your personal content guard.
Be adaptable, be flexible, and help your design stand up to any challenge.
Flex-end alignment for a grand finish
Sometimes, it's all about the last impression. Bring elements to the end of your container with flex-end for a clean, polished look.
Being flexible was never this stylish.
Was this article helpful?