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 Customizing Colors and Fonts Use Color in CSS

Masae Okada
Masae Okada
5,742 Points

Why do I have to use the property of "border-color" ?

I don't know the reason for putting border-color property here.

header { background: #6ab47b; border-color: #599a6b; }

because it works without it. This nav rule below changes the background color..

nav { background:#599a6b; }

So, I don't see the point to use border-color property here.

Sorry for my poor english and thanks for helping me in advance.

3 Answers

Emma Willmann
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Emma Willmann
Treehouse Project Reviewer

These two property change the color of two different things; the background changes the color of the background while the border-color changes the color of the border. However, if you don't have a border-width set, you won't see a change in the border color. So, something like this:

header { 
   background: #6ab47b; 
   border-color: #599a6b; 
   border-width: 2px;
}
Seth Duncan
Seth Duncan
11,844 Points

Hey Masae!

Is this question directly related to a quiz question or are you working on an HTML document yourself? Can you give me more context? My first thought would be the nav background is more broad than the header border. You may select more than you bargain for when using the nav background. I'm not sure if that helps?

EDIT: Emma said it better! They are two different things. The same result may be occurring visibly, but it is probably coincidence. Be sure to specify a border-width.

Masae Okada
Masae Okada
5,742 Points

Thanks Emma and Seth ;) I got it!!!