Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Basics (2014) Basic Layout Lists

Ryan Schmelter
Ryan Schmelter
9,710 Points

Why doesn't declaring 0 padding for the li selector remove the default indentation?

It does when applied to ul and ol selectors, but no li?

Steven Parker is 100% right, but just to restate what he said.

ul and ol are the containing elements for list items (li) the left default padding is applied to the containers, not the individual li's. So since li left padding is 0 by default, setting it to zero has no effect and also doesn't affect the left padding on the containing element (ul or ol).

1 Answer

Steven Parker
Steven Parker
230,249 Points

The indentation of list items is a result of padding in the list itself.

So to remove the indentation of the list items:

ul, ol {
    padding-left: 0;

You apparently discovered this part already. :wink: