Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Stacy Fabian
2,246 PointsWhen to use "background:" and when to use "background-color:"?
In showing how to change the CSS styling of background colors, sometimes the videos instructs to use "background" and sometimes it instructs to use "background-color", maybe I missed it, but I can't tell how to quickly know when to use which one? If anyone can "dumb it down" or "simplify" it for me, that would be awesome. :)
3 Answers

Kevin Korte
28,135 PointsBackground
is a 'shorthand'. Background-color
is very specific. It is expecting a color. Background
could be a color, or an image, etc. I usually just use the background
shorthand because it's faster to write.

Michael Hulet
47,869 PointsI'm pretty sure they're interchangeable, but I personally just use background in every situation. It makes changing the background with JavaScript easier, and it's also technically shorter than background-color, which theoretically saves file size and thereby network load and transmission time, but the difference there is so small that it's virtually nonexistent. As far as I understand, though, it's really your choice

Stacy Fabian
2,246 PointsOk, that's what it seemed like to me but I wanted to make sure I wasn't missing something. Thanks!