What's the difference between specifying a background color using background
and background-color
?
Snippet #1
body { background-color: blue; }
Snippet #2
body { background: blue; }
What's the difference between specifying a background color using background
and background-color
?
Snippet #1
body { background-color: blue; }
Snippet #2
body { background: blue; }
With
background
you can set allbackground
properties like:background-color
background-image
background-repeat
background-position
etc.
With
background-color
you can just specify the color of the backgroundVS.
More info
(See Caption: Background - Shorthand property)
There's a bug regarding with background and background-color
the difference of this, when using background, sometimes when your creating a webpage in CSS background: #fff // can over ride a block of Mask image("top item, text or image")) so its better to always use background-color for safe use, in your design if its individual
I've found that you cannot set a gradient with background-color.
This works:
This doesn't:
They're both the same. There are multiple background selectors (i.e.
background-color
,background-image
,background-position
) and you can access them either through the simplerbackground
selector or the more specific one. For example:or