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
color: initial; vs color:black;
In the video https://teamtreehouse.com/library/css-basics/fundamental-concepts/inheritance, Guil is talks about inheritance. He states that you can tell the browser to ignore inheritance with color: initial. In this particular scenario, it sets the color to black, if you want the text to appear black why would you opt for color: initial; over color: black; in this particular scenario?
(likewise, why would you use color: initial; over color: [hex/rgb/color name]; if the desired color is the same?)
I cannot see it being used in this particular scenario (or many at all) as it does not save multiple lines of code, they are both simply one line, which leads me to the question, is it based on preference?.
Could it have to do with different browsers? Mozilla, Chrome, IE, Opera, etc have different companies running them or are open source.
It could be that each browser has a different default color so initial takes the color back to the browser default which may not necessarily be black in color.
Steven Parker229,005 Points
The choice should be based on intention.
If you want the color to be black, you should set it to black explicitly.
You would use "initial" if you wanted to set it to the color it would have if no value were set for any ancestor it might inherit from. Generally, this happens to be black but that's really up to the browser.