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

213
Visualizações
How to make content display in three columns instead of one column?

I am a beginner and learning from a tutorial using an API. I would like to change the layout of the design, and instead of having one column, I would like a three column layout. I don't know if I am using flexbox correctly.

I have tried using row and then having three columns, but somehow its not displaying correctly.I am also using bootstrap.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

What you're looking for is CSS Grid, which lets you display elements in rows and columns.

Just change your flexbox to a grid with 3 equal columns:

/* display: flex; */
display: grid;
grid-template-columns: repeat(3, 1fr);
about 4 years ago · Juan Pablo Isaza Relatório

0

first of all, we need to clean up your HTML structure.

since in your javascript you are appending all of the cards in a class "images-container" we have to remove the duplicate divs.

<div class="container-fluid">
    <div class="row">
      <div class="col-md-4">
        <div class="images-container"></div>
      </div>
      <div class="col-md-4">
        <div class="images-container"></div>
      </div>
      <div class="col-md-4">
        <div class="images-container"></div>
      </div>
    </div>
  </div>

and turned them into. so it will only appended into a single container and do our flex there.

  <div class="container-fluid">
    <div class="row">
      <div class="images-container"></div>
    </div>
  </div>

The next one is CSS, I added a "flex-wrap: wrap" on the "images-container" so that the cards will go into the next line whenever there is no space left.

/* Images Container */
.images-container {
  width: 100%;
  margin-top: 50px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

and since you are following bootstrap class names you have to add media queries on classnames with breakpoints so. it says the card will take 12 columns on xs "smallest screen" and 4 columns on medium screen.

.col-xs-12 { 
  width: 100%;
}

@media onyl screen and (min-width: 767px) {
  .col-md-4 {
    width: 33% !important;
  }
}

now on javascript. since we got our cards inside "images-container". then we need to add the classname "col-md-4" and "col-xs-12" on the card directly so it will have it's own width

    // Card Container
    const card = document.createElement("div");
    card.classList.add("card");
    card.classList.add("col-md-4");
    card.classList.add("col-xs-12");

sorry for the long explanation I'm still improving my explanation skills hopefully it will help you out.

about 4 years ago · Juan Pablo Isaza Relatório
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