by paulddraper · 8y ago · 0 comments
I want to left align one element and right align another, keeping them in the same row.
Flex makes this very easy:
<div style="display:flex; justify-content:space-between">
<div>Left</div>
<div>Right</div>
</div>
Does grid also make this easy? <div style="display:grid; grid:auto/repeat(auto-fit,minmax(min-content,0)); justify-content:space-between;">
<div>Left</div>
<div>Right</div>
</div>
There's one gotcha: repeat() doesn't seem to accept min-content as its own value, so I had to use minmax(min-content,0).It's strictly less effort to do this with flex, but I expect that as soon as you have more than two single-word divs as children, Grid becomes more useful.