Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style backgroundRepeat property

Style backgroundRepeat property

Style Object Reference The Style object


Definition and Usage

The backgroundRepeat property sets or returns how a background image is repeated.

Syntax

Set the backgroundRepeat property:

Object.style.backgroundRepeat="repeat|repeat-x|repeat-y|no-repeat|inherit"

Return the backgroundRepeat property:

Object.style.backgroundRepeat

Value Description
repeat Default. The background image is repeated both vertically and horizontally.
repeat-x The background image is repeated horizontally.
repeat-y The background image is repeated vertically.
no-repeat The background image is not repeated.
inherit The background-repeat property is inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the backgroundRepeat property.

**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".


Example

Example

Set the background image to repeat vertically:

Runoob Tutorial(runoob.com)


Hello World!

This is a paragraph

    

Try it »


Style Object Reference The Style object