Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
how to move images inside a list tag into the next line?

so I have used a img tag inside a list tag to show 5 images which will be shown inline and I want to add more images below the current images in the same order when I add more images it all shows in the same line how can I move to the next line ?

  <body>
    <div class="imgBox"><img src="" alt="" /></div>
    <ul class="Thumbnail">
      <li>
        <a href="img1.jpg" target="imgBox"
          ><img src="img1.jpg" width="120px"
        /></a>
      </li>
      <li>
        <a href="img2.jpg" target="imgBox"
          ><img src="img2.jpg" width="120px"
        /></a>
      </li>
      <li>
        <a href="img3.jpg" target="imgBox"
          ><img src="img3.jpg" width="120px"
        /></a>
      </li>
      <li>
        <a href="img4.jpg" target="imgBox"
          ><img src="img4.jpg" width="120px"
        /></a>
      </li>
      <li>
        <a href="img5.jpg" target="imgBox"
          ><img src="img5.jpg" width="120px"
        /></a>
      </li>
    </ul>
</body>

Current Code

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use flexbox to align items horizontally in row display: flex; and flex-wrap:wrap to get in to the next line

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 62.5%;
}

body {
  min-height: 100vh;
  width: 100%;
}

img {
  max-width: 100%;
  display: block;
}

ul,
li {
  list-style-type: none;
}

.Thumbnail {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}
 <div class="imgBox">
      <img src="" alt="" />
      <ul class="Thumbnail">
        <li>
          <a href="unsplash.jpg" target="imgBox"
            ><img src="https://source.unsplash.com/user/erondu/200x200"
          /></a>
        </li>
        <li>
          <a href="img2.jpg" target="imgBox"
            ><img src="https://source.unsplash.com/user/erondu/200x200"
          /></a>
        </li>
        <li>
          <a href="img3.jpg" target="imgBox"
            ><img src="https://source.unsplash.com/user/erondu/200x200"
          /></a>
        </li>
        <li>
          <a href="img4.jpg" target="imgBox"
            ><img src="https://source.unsplash.com/user/erondu/200x200"
          /></a>
        </li>
        <li>
          <a href="img5.jpg" target="imgBox"
            ><img src="https://source.unsplash.com/user/erondu/200x200"
          /></a>
        </li>
      </ul>
    </div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!