0

How do I reduce or remove this space when wrapping? What also causes this behavior.

Here is the screenshots and code

enter image description here

enter image description here

#gallery .card-container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 100%;
  flex-wrap: wrap;
  gap: 10px;
}

.card-container .card {
  border: solid black 1px;
  height: 40%;
  width: 30%;
  flex: 1 1 21rem;
}
<section id="gallery">
  <div class="card-container">
    <div class="card">
      <h1>test</h1>
    </div>
    <div class="card">
      <h1>test</h1>
    </div>
    <div class="card">
      <h1>test</h1>
    </div>
  </div>
</section>
The Fool
  • 16,715
  • 5
  • 52
  • 86
nemokris
  • 13
  • 3

1 Answers1

-2

Write CSS in this format:

#gallery .card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-container .card {
  border: solid black 1px;
  height: 50%;
  width: 50%;
}
Michael M.
  • 10,486
  • 9
  • 18
  • 34
Deva
  • 97
  • 2
  • 4
    Code-only answers are discouraged; please try to explain what you've changed and why. If you can provide your solution as a StackSnippet, as the OP has been kind enough to do, that would also be appreciated. – Jake Mar 23 '23 at 07:01