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

155
Visualizações
Q: Regular vertical ul but with li elements horizontally ordered

I want to make a list that has 3 li elements ordered horizontally. These show up thanks to a function. But when triggering this function again I want the new li elements to show up below the last ones, in a vertical way like a regular list. I managed to get the 3 li in ordered horizontally but can't find a way to make it work like a vertical list. A new entry for the list shows up right next to the last one instead of below it.

Explaining my JS code: I appended all three li elements with a delete button to delete that full entry that contains all 3 li.

What I got:

CSS


.list {
list-style: none;
text-align: center;
}

.list li {
display: inline;
}

JS


const btn = document.createElement('button');
btn.type = 'button';
btn.textContent = 'X';
btn.addEventListener("click", (e) => deleteExpense(e));

const li3 = document.createElement('li');
li3.textContent = `${amount}`;

const li2 = document.createElement('li');
li2.textContent = `${date}`;
li2.appendChild(li3);

const li1 = document.createElement('li');
li1.textContent = `${place}`;
li1.appendChild(li2);

li1.appendChild(btn);

list.appendChild(li1);

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