concept

flex-line-collection — CSS reference

In multiline flex layout, successive items in order-modified sequence are assigned using their outer hypothetical main sizes and gaps. An oversized first item still occupies a line. Flexible lengths are resolved after line membership is determined.

Formal Syntax & Structure

css syntaxcss
flex-wrap: wrap;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS flexible sizing lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#p{display:flex;width:300px;align-items:flex-start;background:#e6eef2} #p>*{box-sizing:content-box;min-width:0;height:30px;background:#128579;color:white} #b{background:#326c9d}#p{width:190px;flex-wrap:wrap;gap:10px}#a,#b{flex:1 1 100px}</style><body><div id="p"><div id="a">A</div><div id="b">B</div></div></body></html>
CSS Reference