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 CSS Selectors Advanced Selectors :nth-child

gene c
gene c
13,630 Points

What is the difference between the CSS property background and background-color?

I'm applying CSS selectors to my <li> tags.

Why is the background property successful in affecting my <li> but background-color does not?

1 Answer

Matthew Long
Matthew Long
28,407 Points

You will need to show us your code in order to provide more for your specific situation. However, background property is actually shorthand for many other properties, including background-color:

  • background-image
  • background-position
  • background-size
  • background-repeat
  • background-origin
  • background-clip
  • background-attachment
  • background-color

All of these properties have default values which are used if one is not given. Learn more about the background property on MDN.