0

I have this plunkr here. How to remove the vertical spacing while using flex-wrap: wrap;

#main {
  width: 200px;
  height: 200px;
  border: 1px solid #c3c3c3;
  display: flex;
  flex-wrap: wrap;
}
<div id="main">
  <div style="background-color:coral;">A</div>
  <div style="background-color:lightblue;">B</div>
  <div style="background-color:khaki;">C</div>
  <div style="background-color:pink;">D</div>
  <div style="background-color:lightgrey;">E</div>
  <div style="background-color:lightgreen;">F</div>
</div>
Shashank Vivek
  • 16,888
  • 8
  • 62
  • 104
User985614
  • 330
  • 1
  • 5
  • 18

2 Answers2

2

You should use align-content: flex-start; on #main

Shashank Vivek
  • 16,888
  • 8
  • 62
  • 104
0

#main {
  width: 200px;
  height: 200px;
  border: 1px solid #c3c3c3;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}
<div id="main">
  <div style="background-color:coral;">A</div>
  <div style="background-color:lightblue;">B</div>
  <div style="background-color:khaki;">C</div>
  <div style="background-color:pink;">D</div>
  <div style="background-color:lightgrey;">E</div>
  <div style="background-color:lightgreen;">F</div>
</div>
pullidea-dev
  • 1,768
  • 1
  • 7
  • 23