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 trialRyan Schmelter
9,710 PointsWhy 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?
1 Answer
Steven Parker
231,236 PointsThe 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.
Lyle Lewton
Courses Plus Student 10,585 PointsLyle Lewton
Courses Plus Student 10,585 PointsSteven 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).