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 How to Make a Website Styling Web Pages and Navigation Build Navigation with Unordered Lists

List Style

While in a list (ie: nav ul {}) why do you have to state "list-style: none;" instead of just "style: none" Doesn't the code take it's direction from the "nav ul"? (ie: it already knows it's within the unordered list in the nav element)? Why do we have to specify further with "list-style:"?

1 Answer

Samuel Chun
Samuel Chun
8,890 Points

Short answer: "list-style: " is the CSS property to style list items.

Long answer: You are correct in saying that nav ul{} indicates that a list is being styled but "list-style: " is the CSS property to style the list elements meaning you have to write "list-style: ". Even though the browser "knows" that it is in a list, this is simply a rule of CSS.

If you look at the MDN for CSS you will see all the CSS properties. You will find "list-style" and information on it. There is also no "style: " CSS property.

Thanks Samuel. That definitely helps clear it up and the referenced link is very helpful.