Kristiyan Tsvetanov
Kristiyan Tsvetanov

Reputation: 1047

Css, li full width of ul

I am trying to make an unordered list where the li elements span the full width of their parent ul. For example, with your browser inspect the following code:

<ul>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>

You will see that the li elements are not 100% of the line. Do you have any suggestions on how to fix that...

enter image description here

The yellow thing is the ul and the text starts like 50px to the right.

Upvotes: 0

Views: 795

Answers (1)

j08691
j08691

Reputation: 208040

The list items (<li>) are taking up 100% of the space they're in. It's the default padding on the <ul> that you're seeing. Remove it with ul {padding:0}

ul {padding:0}
<ul>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>

Upvotes: 3

Related Questions