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

Omer Asadullah
10,415 Pointsbackground: or background-color:.... Which is the correct way?
In CSS Deep Dive videos Guil sometimes types background: and sometimes background-color: to set the color of background of an element. My question is which is the correct and appropriate way? Or are both valid?
4 Answers

Mugdha Raidani
6,219 Pointsbackground-color is used to define color only where as background is a short hand property to define various background properties in a single line which includes color also. Hope this helps.

wouters
6,230 PointsThat he use them both will mean it doesn't matter what you use

wouters
6,230 PointsThat he use them both will mean it doesn't matter what you use

Trevor Wagner
30 PointsMugdha is right. This becomes important when you are writing larger css files. Sometimes you will have issues overwriting background: and background-color: based on inheritance. I would always use background if you have an image that needs a fallback color, but not if you only need a color.
Omer Asadullah
10,415 PointsOmer Asadullah
10,415 PointsOk. Thanks for your reply.