Sets or retrieves how the background-image property of the object is tiled.
Syntax
{ background-repeat: sRepeat }
Possible values
sRepeat
String that specifies or receives one of the following values:
repeat | Default. Image is repeated horizontally and vertically. |
no-repeat | Image is not repeated. |
repeat-x | Image is repeated horizontally. |
repeat-y | Image is repeated vertically. |
This property has a default value of repeat. It is not inherited.
Remarks
The repeat-x and repeat-y values make the image repeat horizontally and vertically, respectively, creating a single band of images from one side to the other.
This property can be set with other background properties by using the background composite property.
Examples
The following example uses the background-repeat property to specify whether the background image is tiled. This example uses a call to an embedded (global) style sheet to tile the image:
![]() | |
---|---|
<style> .style1 {background-image: url(sphere.jpg); background-repeat: repeat} .style2 {background-image: url(sphere.jpeg); background-repeat: no-repeat; } </style> </head> <body> <span onmouseover="this.className='style1'" onmouseout="this.className='style2'" onclick="this.className=''"> . . . </span> |
Standards information
This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1).
Applies to
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CUSTOM, DD, DEFAULTS, DFN, DIV, DL, DT, EM, FIELDSET, FORM, HN, HTML, I, IMG, INPUT TYPE=BUTTON, INPUT TYPE=CHECKBOX, INPUT TYPE=FILE, INPUT TYPE=IMAGE, INPUT TYPE=PASSWORD, INPUT TYPE=RADIO, INPUT TYPE=RESET, INPUT TYPE=SUBMIT, INPUT TYPE=TEXT, LI, OL, P, S, SPAN, SUB, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP