Tutorials Point

  CSS Home

  CSS Reference
  Pseudo Classes & Elements

Copyright © 2014 by tutorialspoint

  Home     References     Discussion Forums     About TP  

CSS - background

previous next AddThis Social Bookmark Button



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.

To Become more comfortable - Do Online Practice

previous next Printer Friendly