Search within TutorialsPark

CSS background Property


A CSS shorthand to set all the background values.


Definition and Notes.

1. The CSS background property is used to declare all background properties in a single declaration at the same place within the stylesheet.

2. For a given declaration of background, it first sets the individual properties to initial value, and then assigns explicit values as declared in the declaration.

3. The properties it can set are:

background-color

background-position

background-size

background-repeat

background-origin

background-clip

background-attachment

background-image


Syntax:

CSS background property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note-If you don't specify one of the property, the browser sets the value as default value of that property.

Attributes

Value Description
background-color Sets the background color.
background-position To Position the image in the element's box.
background-size Specifies the size at which the background image will be drawn
background-repeat To set the repeat style for the background Image.
background-origin Sets the point at which the background image will be drawn
background-clip Sets the area in which the background color and background image are visible
background-attachment To set the attachment of the background to the element.
background-image To set an image as the background

Specifications

Specs Value
Name background
Value see Syntax
Initial Value Same as Individual Properties.
Applies to all elements.
Javascript syntax object.style.background="blue url(chrome.png) bottom left no-repeat"
Inherited No
Browser Support internetexplorer safari firefox opera chrome

Related Examples.