Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to break multiple divs in next line if can't fit

I want to put multiple divs in same row and if they cant fit to break to next line.I want this enter image description here instead of this enter image description here

.cardContainer {
  display: flex;
}

.card {
  min-width: 185.17px;
  height: 88px;
  border-radius: 8px;
  background: red;
  margin-right: 8px;
  display: block;
}
<div className="cardContainer">
  <div className="card">A</div>
  <div className="card">A</div>
  <div className="card">A</div>
  <div className="card">A</div>
  <div className="card">A</div>
  <div className="card">A</div>
  <div className="card">A</div>
</div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

.item {
  width: 20%;
  height: 50px;
  background-color: red;
}
<div class='container'>
 <div class='item'></div>
 <div class='item'></div>
 <div class='item'></div>
 <div class='item'></div>
 <div class='item'></div>
 <div class='item'></div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading