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

106
Views
Having Issues with Flexbox

Trying to create dynamic react-mdl cards with specific height and widths. The problem is coming from a float being longer than the width of the card it is in. How can I fix the float or containers to allow cards equally spaced and dynamically sized on each row.

Here is the current code for the container and card HTML

  <Card className="card">
    <CardTitle className="card-title">
      <img className="item-image" src={icon} alt={alt}/>
    </CardTitle>
    <CardText className="card-text">
      <div>Id: {id}</div>
      <div>Quantity to buy: {quan}</div>
      <div>Total Profit: {profit}</div>
    </CardText>
  </Card>

CSS

.itemlist {
    background-color: rgb(211, 208, 208);
    position: relative;
    border: 2px solid red;
    width: 50%;
    height: 100%;
    float: left;

    display: flex;
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: auto;
}

.card {
    display: flex;
    width: auto;
    height: auto;
    border: 2px solid black; 
    background: green;
    margin: 0 10px;
}

.card-title {
    height: 100px;
    color: #fff;
    background: red;
    justify-content: center;
    align-items: center;
}
.item-image {
    width:auto;
    height:auto;

}[enter image description here][1]
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!