CSS - background


background is a shorthand element used to set background styles for an element.

Possible Values:

background is a shorthand property and stand for the following. This value will vary depending on actual property.

  • background-color: Sets a solid color for the element's background, padding, and border background.

  • background-image: Defines the location of an image to be placed in the element's back- ground.

  • background-repeat: Sets a repeat direction for an image in the element's background.

  • background-attachment: Sets an attachment state for any images in the element's background

  • background-position: Sets a position for the origin image in the element's background

Applies to:

All the HTML elements.

DOM Syntax:

object.style.background="Value according to the used propery";


<p style="background:url(images/pattern1.gif) repeat fixed;">
This parapgraph has fixed repeated background image. </p>


Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508