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 trialBen Brenton
266 PointsTrouble with assigning values to <nav> tag in CSS
I am trying to designate certain values to items in my <nav> tag on my project but am having little success. I am able to align the text, but am not able to change the color. All brackets are properly placed and cannot see a coding problem, would anything else be preventing this from working?
2 Answers
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsHi Ben,
Maybe you are selecting wrong: my opinion you are selecting the <li> tag in your <nav> -> to style the color of the list items which are probably <a> elements add the "a" selector to your CSS. The "li" selector doesn't select the inner anchor but only the anchor parent.
Should look like this then (add it under the selector for your list items):
nav ul li a {
color: red;
}
Or you are overwriting the selector rule lower down your CSS: be carefull CSS stands for Cascading Style Sheets -> Keyword is "Cascading" = meaning that if you write a rule for a selector on line 15 for example and then target the same selector 20 lines down the lowest targeting overwrites the top.
Ben Brenton
266 PointsSorry for long delay in replying! Jacob Mishkin, you are right to point out my error I should always post code as it is more helpful in receiving an answer, apologies!
Nejc Vukovic, I stumbled upon the right way of doing it by trial and error but you suggested the same thing so thank you!
Jacob Mishkin
23,118 PointsJacob Mishkin
23,118 Pointsplease paste in your code so we can see what's wrong. thanks!