Example

A simple background property example:

Laboratory

description & Usage

The background property is a brief property for:

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

is.

Informations

# Description
Default Value see individual properties
Inherited no
Animatable yes
Version CSS1 + new properties in CSS3
JavaScript syntax object.style.background="red url(smiley.gif) top left no-repeat"

Browser compatibility and Support

The numbers inserted in the browser fields indicate the version that supports the background property.

# Chrome Edge Firefox Safari Opera
background

Syntax

Values

Values Description
background-color Determines the background color on each page.
background-image Determines the number of images in the background of the page.
background-position Determines the size of the images in the background of the page.
background-size Determines the size of the images in the background of the page.
background-repeat Determines how to repeat images in the background of the page.
background-origin The positioning area determines the images in the background of the page.
background-clip The drawing area determines the images in the background of the screen.
background-attachment It is used to determine whether the images in the background are fixed or should move along with the user's scrolling.
initial Adds this value to its default property.
inherit It inherits this value from its parent tag.

Related Pages

CSS Tutorial: CSS Background, CSS Background (Advanced)

HTML DOM Reference: The background attribute