Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda