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 trialvestan
1,908 Points#nav ul vs. nav ul
Hello - I'm loving this course and I have a question on this video:
At around the 4:00 mark, instead of:
nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
could we add an id to the nav ul html and do this:
#nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
Or is it not possible because that attribute cannot be repeated on a single page?
Thank you!
3 Answers
Robert Manolis
Treehouse Guest Teachera rule applied to the id or "#" will override a rule applied to the element itself or "nav" because of specificity... I think... I'm still pretty new to all this. But as I understand it, any rule applied to the "nav ul" will also be applied to any "nav ul" on any page connected to that particular css, but a rule applied to the more specific id or "#" will only apply to the particular element bearing that particular id.
Hope that helps.
Philip G
14,600 PointsYes it's the same...
vestan
1,908 PointsThank you very much, Gentlemen, for your replies.
That explanation makes it clearer for me, Robert, thank you!
Robert Manolis
Treehouse Guest TeacherMy pleasure. Just glad I could help. :)
Philip G
14,600 PointsPhilip G
14,600 PointsBut a inline style is only overwritten by !important.