Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda