I have multiple flexbox containers with child divs aligned within in them.
The containers have varying numbers of child divs. Some have just one child and some have so many children that they overflow the container div, requiring a scroll.
I want the containers with just one or a few child divs to justify content from the center.
However, if there are so many divs that they overflow, I want to make sure the first item(s) does not get cut off.
I have a JSfiddle demonstrating the issue. In the first container, the first few items get cut off, but I want them to start with item one justified left. Is this possible?
.container{
width: 100%;
background-color: gray;
overflow: scroll;
display: flex;
gap: 1em;
justify-content: center;
}
.items{
width: 100px;
height: 100px;
display: inline-block;
flex-grow: 0;
flex-shrink: 0;
background-color: blue;
color: white;
text-align: center
}