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

170
Vistas
How to make the last element of every flex-wrapped row take up the remaining space?

I'm trying to figure out how to ensure that the last element of every row takes up the remaining space of the row that it's in. I've played around with the width and other flex properties, but I wasn't able to get this to work.

The last element currently does not take up the rest of the space in the row.

img1

What am I doing wrong?

serverless-moon-wx68rx

const styles = {
  container: {
    padding: "1rem",
    border: "1px solid black",
    height: "100%",
    display: "flex",
    flexWrap: "wrap"
  },
  box: ({ index }) => ({
    height: "2rem",
    width: index % 2 === 0 ? "3rem" : index % 3 === 0 ? "5rem" : "7rem",
    border: "1px solid gray",
    margin: "1rem"
  })
};

export default function App() {
  return (
    <div style={styles.container}>
      {Array.from({ length: 7 }, (_, index) => {
        return <div style={styles.box({ index })} />;
      })}
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza
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