CSS background

The CSS background property is a shorthand property for setting the background of an HTML element. This enables you to set all your background properties with one property.


Syntax: background: <value1> <value2> ...
Possible Values:
  • <background-image>
  • <background-position>
  • <background-size> (introduced in CSS version 3)
  • <background-repeat>
  • <background-attachment>
  • <background-color>
  • inherit
Initial Value: See individual properties
Applies to: All elements
Inherited: No
Media: Visual
Example background: url("/pix/smile.gif") #ff9900 90% 30% no-repeat fixed
Try it yourself!