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!
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

mrx3
8,742 PointsWhere to change my font-size for my navigation bar in css?
I'm not sure if I need to make the font-size change in the .nav class, or the .nav a class. When I add the my font size to the .nav class, or the .nav a class it does change my font size, but I'm unsure of which one is the correct one. Are both okay to make font size changes, or should one be used over the other. My code is below, and thanks in advance for the help.
.nav {
border: 1em solid #ccc;
border-width: .1em 0;
list-style: none;
margin: 0;
padding: 0;
text-align: center;
}
.nav li { display: inline; }
.nav a {
display: inline-block;
padding: .63em;
text-decoration: none;
}
3 Answers

Adam Sackfield
Courses Plus Student 19,663 PointsGreat. I personally would use the more specific ".nav a" selector. The reason is you you add other text to the nav later and want to resize it wouldn't affect your links too. But I guess it's personal preference really.

mrx3
8,742 PointsYou're right Adam. I plan on adding more text to the nav later, and expanding the site. It would make more sense to use the ".nav a" selector. Thanks again for the help Adam, much appreciated, and to Jonathan as well.

Adam Sackfield
Pro Student 19,663 PointsAnytime! Good luck! Feel free to follow on twitter as I post a few tips on there too. @Sacki2013

Jonathan Grieve
Treehouse Moderator 91,243 Pointstry selecting .nav. That way your anchor elements will inherit the same font size if it's wrapped inside your li tags as they should be. :)

mrx3
8,742 PointsAdam this is something I made from scratch. I'm practicing the concepts I've learned so far on the site, it's kind of my resume site. Thanks Jonathan, and Adam for your help.

Jonathan Grieve
Treehouse Moderator 91,243 PointsYou're welcome. :)
Adam Sackfield
Pro Student 19,663 PointsAdam Sackfield
Courses Plus Student 19,663 PointsIs this CSS from a theme or something you created from scratch?