CSS background-repeat property
Only repeat background-image vertically:
{
background-image:url('paper.gif');
background-repeat:repeat-y;
}
Try it out . . .
Label definition and instructions for use
Set how to tile the object's background-image property.
By default, the vertical and horizontal orientations of background-image are repeated.
Default: | repeat |
---|---|
Inherited: | no |
Version: | CSS1 |
JavaScript syntax: | object.style.backgroundRepeat="repeat-y" |
Browser support
The numbers in the table support the first browser version number of the property.
The number immediately before -webkit-, -ms- or -moz- is the first browser version number that supports the prefix property.
<Property | |||||
---|---|---|---|---|---|
background-repeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
IE8 and earlier browsers do not support multiple background images in one element.
Note I E7 and earlier versions do not support the value of inherit. I E8 needs to be defined! D OCTYPE。 IE9 supports inheritance.
Tips and comments
Tip: The background-position property sets the background image position. If the specified position is without any background, the image is always placed in the upper left corner of the element.
The property value
Value | Description |
---|---|
repeat | The background image repeats vertically and horizontally. This is the default |
repeat-x | Only the horizontal position repeats the background image |
repeat-y | Only vertical positions repeat the background image |
no-repeat | Background-image does not repeat |
inherit | Specifying the background-repea property setting should be inherited from the parent element |
Online instance
How to repeat the background image vertically and horizontally
This example shows how to repeat a background image vertically and horizontally.
How to repeat the background image only horizontally
This example shows how to repeat a background image only horizontally.
How to display the background image only once
This example shows how to display a background picture without repeating it only once.
Related articles
CSS tutorial: CSS Background
CSS Reference Manual: Background-position Properties