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 trialHadi Farhat
Courses Plus Student 7,102 PointsWhy did Nick Pettit use background for colors instead of background-color
We usually use background-color for the color of the background, is there a difference between background-color and background ?
3 Answers
Diego Murray
2,515 PointsThere's no exact difference. Background is a shortcut. For example, You can list items such as background-color: blue; background-position: center; background-repeat: none;
Using the background property you can put all of those in one line of code.
Jeff Lemay
14,268 Pointsbackground-color accepts a color only, while background is shorthand for using background color, background image, background repeat, background position, etc.
You can use background in place of background-color and achieve the same result.
Dan Oswalt
23,438 PointsThe background property can take a list of several arguments, including color, just like border can take several elements (black solid 2px).
Background-color is just more specific.