Copyright © tutorialspoint.com

# CSS - background

## Description:

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";

## Example:

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

To Become more comfortable - Do Online Practice

Copyright © tutorialspoint.com