To space-between, or not to space-between
🤔
when spacing two flex items to the opposite ends in a flex container on the x-axis (flex-direction: row), is it best to use justify-content: space between or set margin right or left auto on one of the flex items? Does it really matter?
3 Replies
No it's preference really ime
I would say it's better to use
justify-content
because that's what's it's for. Anyone (especially you!) in the future who reads the CSS knows exactly what's happening b/c the flex container has all the flex-based layout instructions. Otherwise you'd have to read not only the flex container's CSS but that of all the flex-children to know what's happening.I agree with @thevanilla13eck, but more important is if you apply whatever you choose consistently throughout a codebase.