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 trialMohammed Istiaq Ullah
2,399 Pointsul, ol and li difference?
say there are ul lists and ol lists, and i want to set a padding of left=0 for them. Why does it only work when I call them using ul, ol in the CSS and not li, which is supposed to select them all together?
1 Answer
Adam Pengh
29,881 PointsThe ol and ul tags describe what type of list it is going to be, ordered list or unordered list. The li tag is for the individual list items. The ul or ol is the outer container for the li elements, so the ol/ul element has different styling applied than the li elements.
You could potentially use li:parent {} to select the parent elements for all li elements, which would usually be the ol or ul elements. Something like the below should work:
li:parent {
}