0

Sorry for my bad English. I'm creating an application to load images. I have a css grid and loading new images via infinite scroll. After that new images adding to grid.

An I have a problem. Previous images changing position when adding new. I think because a grid does searching where add it.

Can I put a new images to grid and don't lost position of previous images? For example, as in Google (Pictures tab).

<!--Images grid-->
<div class="images-grid">
    <div class="item"><img src="..." /></div>
    <div class="item"><img src="..." /></div>
    <div class="item"><img src="..." /></div>
    <div class="item"><img src="..." /></div>
    <div class="item"><img src="..." /></div>
    <div class="item"><img src="..." /></div>
    <div class="item"><img src="..." /></div>
</div>

CSS

.images-grid {
    display: grid;
    column-count: 4;
    column-gap: 0;
}

I changed the css code:

.images-grid {
    display: flex;
    flex-wrap: wrap;
}

An I getting blocks with the same height.

Images grid

I need images with different height and the same width. (Like here) Flex

General2001
  • 321
  • 1
  • 5
  • 9

0 Answers0