I am making a web-site. There is content part with specific width. Inside there are flex-boxes with image. The number of images may be different (not more than 5) and the width of each image must be calculated to fit them all.
The strange thing is that in FireFox
this work fine, but in Chrome
or Yandex
.
Seem, that images don't auto-fit in flex-box, because of height: 400px;
the width: 100%
tries to correspond that 400px
height.
Here is HTML and CSS parts:
HTML
<div class="article-images">
<img src="../images/newsImages/img_6_4.jpg" class="article-images-item" />
<img src="../images/newsImages/img_6_5.jpg" class="article-images-item" />
<img src="../images/newsImages/img_6_6.jpg" class="article-images-item" />
<img src="../images/newsImages/img_6_9.jpg" class="article-images-item" />
</div>
CSS
.article-images {
display: flex;
flex-direction: row;
justify-content: space-evenly;
gap: 20px;
width: 100%
}
.article-images-item {
width: 100%;
height: 400px;
object-fit: cover;
border-radius: 2px;
cursor: pointer
}