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

187
Views
How to make flex wrap with same horizontal spacing for each line

I have a layout with an indefinite number of cards with flex, but when the line breaks to reach the final horizontal size, there is a very large spacing between the items on the bottom line. How can I leave normal spacing?

Example

.album {
    margin-top: 80px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}
<div class="container">
<div class="albums">
{% for album in albums %}
  <div class="{% if album.ping == ''%}card-without-pin{% else %}card{% endif %}" style="width: 18rem;" data-id="{{album.id}}">
    <div class="card-header"><i class='bx bxs-photo-album bx-lg'></i></div>
    <div class="card-body">
      <h4>{{album.name}}</h5>
      <p class="card-body-text">{{len(album.imgs)}} photos</p>
    </div>
  </div>
  <hr>
{% endfor %} 
</div>
</div>
about 4 years ago · Juan Pablo Isaza
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!