FANDOM


The background property is used in CSS and certain HTML elements. It is a shorthand property for setting the individual background property values in a single place in the style sheet. This property can be used to set the values for one or more of: background-color, background-image, background-repeat, background-position, background-size, and/or background-attachment.


Values

Any values from the background-color, background-image, background-repeat, background-position, and background-attachment properties can be used in the background property. A single space is used to separate each individual value.


HTML example:

<body style="background: #000 url(http://images1.wikia.nocookie.net/__cb20100810165854/htmlcss/images/f/fb/HtmlcssBG.png) repeat-y center;">
Body content.
</body>


CSS example:

body {
      background: #000 url(http://images1.wikia.nocookie.net/__cb20100810165854/htmlcss/images/f/fb/HtmlcssBG.png) repeat-y center;
}
Community content is available under CC-BY-SA unless otherwise noted.