0

I want to know that what is the main difference between these properties

body {
background-image: url("paper.gif");
} 

and

body {
background: url("paper.gif");
} 

both above properties results in a same way, showing a background image, and we can also put the color like that too

body { background-color: #cccccc; }

and

body {
background: #cccccc;
} 

both above properties results in a light grey background color, so what's the main difference between these properties?

  • http://stackoverflow.com/questions/10205464/what-is-the-difference-between-background-and-background-color – Turcia Jan 13 '15 at 09:14

1 Answers1

3

The background property is a shortcut, which allows you to specify multiple parameters in one statement. For example, you could use:

background: #00ff00 url("background.png") no-repeat fixed center;

When you use the background-color property, you are specifically setting only the color. Therefore, in your examples, there is effectively no difference - the end result will be the same whichever method you use.

Alan
  • 2,962
  • 2
  • 15
  • 18