Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1623

Flex container stretches to full width when items wrap [duplicate]

$
0
0

I want the flex container to expand as much as the largest row when the items wrap.Given the container below, it should expand as much as the first row, leaving no gap on the sides.

enter image description here

#main {  display: inline-flex;  justify-content: center;  gap: 16px;  flex-wrap: wrap;  border: 1px solid #c3c3c3;}#main div {  height: 50px;}
<div style="width: 200px; text-align: center;"><div id="main"><div style="width: 145px; background-color:coral;">1</div><div style="width: 40px; background-color:lightblue;">2</div><div style="width: 70px; background-color:khaki;">3</div><div style="width: 100px; background-color:pink;">4</div></div></div>

Viewing all articles
Browse latest Browse all 1623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>