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

105
Visualizações
How to loop through a JSON with EJS while being able to style each item separately

I am trying to loop through a JSON file while using EJS and style each object like a card, but it keeps coming out looking like a child element inside each object looped through before it.

Here is my current EJS code

<section class="job-list">

    <% if (job.length > 0) { %>
        <div class="grid">
            <%for(var i = 0; i < job.length; i++){ %> 
                <article class="card listing-item">
                    <header class="card__header">
                        <img src="<%= job[i].logo %>" alt="">

                    </header>
                    <div class="card__content">
                        <div class="card_content_top">
                            <p class="position_postedAt"><%= job[i].postedAt %></p>
                            <p class="position_contract"><%= job[i].contract %></p>
                        </div>
                        <div class="card_content_bottom">
                            <h1 class="position__position"><%= job[i].position %></h1>
                            <h3 class="position__company">$<%= job[i].company %></h3>
                            <p class="position__location"><%= job[i].location %></p>

                        </div>

                    </div>
                    
            <% } %>        
        </div>
    <% } else { %>
        <h1>No Jobs found today!</h1>    
        <% } %>

</section>

I am currently getting this:

current output

while trying to make it look like seperate cards:

items as seperate cards

I have tried playing around with using a grid with the grid class and the listing-item class, but it keeps styling them inside the others.

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

0

I think that you are missing the closing tag </article> for article html element.

Article HTML tag: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article

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