English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
CSS background-repeat Attribute Specifiesbackground-imageWhether the background image will repeat or tile after the size and position adjustments, and how to tile. Use the shorthandBackgroundAttributes are usually more convenient.
The following table summarizes the usage context and version history of this attribute.
Default Value: | repeat |
---|---|
Applicable To: | All Elements |
Inheritance: | None |
Animatable: | No.Please See Animation Attribute. |
Version: | CSS 1,2,3 |
JavaScript Syntax: | object object.style.backgroundRepeat="repeat-x" |
The syntax of this attribute is as follows:
background-repeat: repeat | repeat-x | repeat-y | no-repeat | initial | inherit
The following examples demonstrate how to use background-repeat Attribute.
body {background-image: url("images/gradient.png");background-repeat: repeat-x;}Test See‹/›
The following table describes the values of this attribute.
Value | Description |
---|---|
repeat | Default Value. The background image will repeat both vertically and horizontally. |
repeat-x | The background image will repeat horizontally only. |
repeat-y | The background image will repeat vertically only. |
no-repeat | The background image will not repeat. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element adopts its parent element's background-Computed Value of repeat Attribute. |
background-Browser Compatibility of repeat Attribute, all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS Background,CSS3Background.
Related Attributes:background,background-attachment,background-color,background-clip,background-image,background-origin,background-position,background-size.