I have a dynamic number of divs in a single container div with display: flex
.
Now, I want my child divs to be centered, so I use justify-content: center
.
This works perfectly for a small number of children (the blue rectangles)
But for a larger amount of children, setting justify-content: center
means that child divs are pushed farther and farther off-screen (the red rectangles).
Children pushed off-screen to the right are still visible because I can just scroll to the right to see the rightmost children.
But children pushed off-screen to the left are not visible because I cannot scroll to the left. This is a problem.
So essentially I want to use flexbox
to center its children but prevent the children from being pushed off-screen to the left. Instead, content should overflow to the right, the way that justify-content: flux-start
works, but still be centered.