background-repeat

Important

This documentation is preliminary and subject to change.

Sets how the background-image property of the object is tiled.

Syntax

{ background-repeat: sRepeat }

Possible values

sRepeat

String that specifies 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) Ee371237.xtlink_newWindow(en-us,Expression.40).png.

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

See also

Concepts

background
background-image

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.