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

221
Views
Fit the content of container

Is it possible to force inner element (div.-not-assignable-) to fit the whole content of div.item-wrapper. The style -not-assignable- can't be defined/changed (if there is no solution will use React.clone to assign a proper style in order to solve the issue - just curious about a pure CSS solution).

.container {
  display: flex;
  border: 1px solid orange;
  height: 50px;
}

.item-wrapper {
  display: flex;
  min-width: 100%;
  border: 1px solid green;
}
<div class="container">
  <div class="item-wrapper">
    <div style="border: 1px solid red;" class="-not-assignable-">Div</div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You could select -not-assignable- via .item-wrapper > div and use the rule flex-grow:1;:

.container {
  display: flex;
  border: 1px solid orange;
  height: 50px;
}

.item-wrapper {
  display: flex;
  min-width: 100%;
  border: 1px solid green;
}

.item-wrapper>div {
  flex-grow: 1;
}
<div class="container">
  <div class="item-wrapper">
    <div style="border: 1px solid red;" class="-not-assignable-">Div</div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report

0

you can remove display flex from the .item-wrapper

.container {
  display: flex;
  border: 1px solid orange;
  
}

.item-wrapper {
  min-width: 100%;
  border: 1px solid green;
height: 50px;
}
<div class="container">
  <div class="item-wrapper">
    <div style="border: 1px solid red;" class="-not-assignable-">Div</div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report

0

display:grid instead of flex will do it because you will have the stretch effect on both sides:

.container {
  display: flex;
  border: 1px solid orange;
  height: 50px;
}

.item-wrapper {
  display: grid;
  min-width: 100%;
  border: 1px solid green;
}
<div class="container">
  <div class="item-wrapper">
    <div style="border: 1px solid red;" class="-not-assignable-">Div</div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report
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!