propriedade HTML DOM Estilo backgroundRepeat
Definição e Uso
backgroundRepeat conjuntos de propriedades ou retornos como repetir uma imagem de fundo.
gramática
Definindo as propriedades backgroundRepeat:
Object.style.backgroundRepeat="repeat|repeat-x|repeat-y|no-repeat|inherit"
Propriedades volta backgroundRepeat:
Object.style.backgroundRepeat
值 | 描述 |
---|---|
repeat | 默认。垂直和水平方向重复背景图像。 |
repeat-x | 水平方向重复背景图像。 |
repeat-y | 垂直方向重复背景图像。 |
no-repeat | 不重复背景图像。 |
inherit | background-repeat 属性的设置从父元素继承。 |
Suporte a navegadores
Todos os principais navegadores suportam backgroundRepeat propriedade.
Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".
Exemplos
Exemplos
Imagem de fundo repetido na direcção vertical:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Style type = "text / css">
body {
background: # f3f3f3 url ( 'img_tree.png');
}
</ Style>
<Script>
displayResult function () {
document.body.style.backgroundRepeat = "repetir-y";
}
</ Script>
</ Head>
<Body>
<Button type = "button" onclick = "displayResult ()"> imagem de fundo de repetição verticais </ button>
<br>
<H1> Olá mundo! </ H1>
<P> Este é um parágrafo </ p>
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Style type = "text / css">
body {
background: # f3f3f3 url ( 'img_tree.png');
}
</ Style>
<Script>
displayResult function () {
document.body.style.backgroundRepeat = "repetir-y";
}
</ Script>
</ Head>
<Body>
<Button type = "button" onclick = "displayResult ()"> imagem de fundo de repetição verticais </ button>
<br>
<H1> Olá mundo! </ H1>
<P> Este é um parágrafo </ p>
</ Body>
</ Html>
tente »
estilo Objects