Skip to content

Background

This list of properties defines the color or image used as the background of a page or an element.


PropertyDescription
backgroundShorthand property grouping all background-related properties.
background-attachmentDefines whether the background image is fixed (fixed) or scrolls with the content (scroll).
background-colorDefines the background color.
background-imageDefines one or more background images.
background-positionDefines the position of the background image (e.g., center, top right).
background-position-xDefines only the horizontal position of the background image.
background-position-yDefines only the vertical position of the background image.
background-repeatDefines how the background image repeats (repeat, no-repeat, repeat-x, repeat-y).
background-sizeDefines the size of the background image (auto, cover, contain, or custom values).

These properties belonged to older versions of Netscape Navigator and should no longer be used.

PropertyStatusExplanation
layer-background-imageNetscape (deprecated)Defined the background and border image in Netscape Navigator 4.
layer-background-colorNetscape (deprecated)Defined the background and border color in Netscape Navigator 4.

  • Use only modern properties (background-color, background-image, background-size, etc.).
  • The properties background-position-x and background-position-y are useful but not strictly necessary: everything can be handled with background-position.
  • Old properties related to Netscape Navigator (layer-background-*) are deprecated.
  • You can apply multiple background images by separating them with commas in background-image.