I'm trying to create a list of items in a responsive container with a consistent gap between them, including items that don't happen to have a full set of items in their row, such as this:
ul {
width: 450px;
padding: 0;
display: flex;
flex-wrap: wrap;
border: 1px solid #F00;
justify-content: space-between;
}
li {
display: inline-block;
height: 100px;
width: 100px;
border: 1px solid #000;
}
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
Problem is the final row has a gap distance between them different than the other rows. I know I can do some quick calculations with javascript to determine the gap space, but I'd like to learn if there's a way to do this only with CSS. A left aligned list with equal gap spacing that changes as the width of the parent container changes (so if the window was a different size and the parent width was 320px, we'd only see 3 items per row, with a gap of 10px between them, including the last row containing 2, with a 110px gap to the right since there isn't a 3rd item in the row).