There is a rubber gallery, the problem is that the width of each of its elements was defined as the initial width of the corresponding image. Accordingly, when the screen is reduced, the width of the element becomes larger than the width of the picture, and when it is reduced, the image does not fit in its container and shrinks in width.
It is necessary to make the height of the picture took all the space allocated to it in the container, and the width - scaled according to the proportions, stretching, respectively, the width of its parent container.
html, body { display: flex; flex-direction: column; height: 100%; width: 100%; align-items: center; justify-content: center; margin: 0; padding: 0; } .slider { display: flex; align-items: center; justify-content: flex-start; flex: 0 1 90%; width: 100%; white-space: nowrap; overflow-x: auto; } .image { flex: 0 1 auto; height: 100%; border: black 1px solid; display: flex; flex-direction: column; justify-content: center; box-sizing: border-box; } .image-container { flex: 0 1 90%; height: 100%; display: flex; } img { max-height: 100%; flex: 0 1 0%; } .text { flex: 1 1 10%; display: block; background: chocolate; text-align: center; padding: 4px 10px; } <div class="slider"> <div class="image"> <div class="image-container"><img src="https://ru.fishki.net/picsw/012012/05/post/krasota/tn.jpg"></div> <div class="text"> <p>Text</p> </div> </div> <div class="image"> <div class="image-container"><img src="https://learn.javascript.ru/article/box-sizing/border-box@2x.png"></div> <div class="text"> <p>Text</p> </div> </div> <div class="image"> <div class="image-container"><img src="https://learn.javascript.ru/article/box-sizing/border-box@2x.png"></div> <div class="text"> <p>Text</p> </div> </div> <div class="image"> <div class="image-container"><img src="https://learn.javascript.ru/article/box-sizing/border-box@2x.png"></div> <div class="text"> <p>Text</p> </div> </div> <div class="image"> <div class="image-container"><img src="https://learn.javascript.ru/article/box-sizing/border-box@2x.png"></div> <div class="text"> <p>Text</p> </div> </div> </div>