Overview - Flex wrap
What is it?
Flex wrap is a CSS property that controls whether flex items stay in a single line or wrap onto multiple lines inside a flex container. When items don't fit in one row or column, flex wrap decides if they should overflow or move to the next line. This helps create flexible layouts that adapt to different screen sizes. It works together with the flex container's direction to arrange items neatly.
Why it matters
Without flex wrap, all items would try to fit in one line, causing overflow or squished content that is hard to read or interact with. Flex wrap solves this by allowing items to flow naturally onto new lines, making websites look good on phones, tablets, and desktops. This improves user experience and accessibility by preventing layout breakage and horizontal scrolling.
Where it fits
Before learning flex wrap, you should understand basic flexbox concepts like flex container, flex items, and flex direction. After mastering flex wrap, you can explore advanced flexbox properties like align-content and flex-grow to create responsive and dynamic layouts.