Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!