I have a row of thumbnails that I want: centered, if they are smaller than the window; and scrollable, if they are bigger than the window.
It's almost working. However, part of the first image disappears to the left of the screen. If I have even more images, the first ones completely disappear. What am I doing wrong?
.container {
background-color:green;
display:flex;
justify-content:center;
overflow-x:scroll;
overflow-y:hidden;
}
.box {
background-color:red;
margin:0.5vh;
}
<div class='container'>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
<div class='box'><img src='https://s3.amazonaws.com/YouGarden/Web/100x100/510187.jpg' /></div>
</div>