CSS background-repeat property
Examples
Only vertical repeat background-image:
{
background-image:url('paper.gif');
background-repeat:repeat-y;
}
try it"
Tag definitions and instructions
How to set the tile object background-image property.
By default, the repeated background-image vertical and horizontal directions.
Defaults: | repeat |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object object.style.backgroundRepeat = "repeat-y" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
Immediately following the digital -webkit-, -ms- or -moz- ago in support of the prefix attribute first browser version number.
<Property | |||||
---|---|---|---|---|---|
background-repeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Multiple background images in one element IE8 and earlier versions of the browser does not support.
Note that IE7 and earlier versions do not support "inherit (inherited)" value.IE8 need to define! DOCTYPE. IE9 support "inherit (inherited)."
Tips and Notes
Tip: background-position property to set the background image position.If the specified location without any background, images are always placed in the top left corner of the element.
Property Value
value | Explanation |
---|---|
repeat | Background image will repeat vertical and horizontal directions. This is the default |
repeat-x | Only the horizontal position of the background image will be repeated |
repeat-y | Only the vertical position of the background image will be repeated |
no-repeat | background-image does not repeat |
inherit | Specifies the background-repea attribute settings should be inherited from the parent element |
Online examples
How to repeat a background image in vertical and horizontal directions
This example demonstrates how to repeat a background image in vertical and horizontal directions.
How to repeat a background image only in the horizontal direction
This example demonstrates how to repeat a background image only the horizontal direction.
How to display the background image only once
This example demonstrates how to display a background image does not repeat only once.
related articles
CSS tutorial: CSS Background
CSS Reference Manual: background-position property