search

Home  >  Q&A  >  body text

Eliminate spacing between images within flex container

[repeat]

Answer here Image inside div has extra space below image

I am displaying some images of different sizes along multiple rows. Example here

But there are gaps between the lines. I tried a lot but couldn't find the reason.

<div class="muralBox">
  <div class="wrapper">
    <div v-for="(topAlbum, i) in topAlbumInfo.value" :key="topAlbum.name" class="albums"> 
      <Album :info="topAlbum" :width="layoutConfig[i].width"/>
  </div>
  </div>
</div>

In Album.vue

<img :src="img" :width="width" :height="width" alt=""/>

and CSS:

.muralBox {
  margin: auto;
  max-width: 400px;
  min-width: 400px;
}
.wrapper {
  background: #1f1c2c;
  display: flex;
  flex-wrap: wrap;
}

P粉921130067P粉921130067244 days ago335

reply all(1)I'll reply

  • P粉451614834

    P粉4516148342024-03-28 11:15:51

    I'm not sure if this is exactly what you want because I can't see how you style them, but I just gave the images 100% height and width, which is basically done in codepen .

    CodePen link

    .albums img{
          height: 100%;
          width: 100%;
         }

    reply
    0
  • Cancelreply