Mehmet Mehmet - 16 days ago 5
HTML Question

How to remove list margin?

I have a list that includes 3 item inside it. However, it has a little margin its left side, I want it to disapper.

Here is my codes:



ul li {
display: inline;
list-style: none;
}

<ul>
<li>I have margin space on my left side</li>
<li>List 2</li>
<li>List 3</li>
</ul>
<p>
Hi! I am a text without any margin!
</p>




Answer

Just set padding of your ul to 0. Here's a snippet:

ul {
    padding: 0;
}

ul li {
  display: inline;
  list-style: none;
}
<ul>
  <li>Hey, now I don't have extra space on my left side!</li>
  <li>List 2</li>
  <li>List 3</li>
</ul>
<p>
Hi! I am a text without any margin!
</p>

Comments