Fundo de estiloRepetir propriedade
Exemplo
Defina uma imagem de fundo para não repetir:
document.body.style.backgroundRepeat = "repeat-y";
Mais exemplos de "Experimente você mesmo" abaixo.
Definição e uso
A propriedade backgroundRepeat define ou retorna como repetir (lado a lado) uma imagem de plano de fundo.
Suporte ao navegador
Os números na tabela especificam a primeira versão do navegador que oferece suporte total à propriedade.
Property | |||||
---|---|---|---|---|---|
backgroundRepeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Sintaxe
Retorne a propriedade backgroundRepeat:
object.style.backgroundRepeat
Defina a propriedade backgroundRepeat:
object.style.backgroundRepeat = "repeat|repeat-x|repeat-y|no-repeat|initial|inherit"
Valores de propriedade
Value | Description |
---|---|
repeat | The background image is repeated both vertically and horizontally. This is default |
repeat-x | The background image is only repeated horizontally |
repeat-y | The background image is only repeated vertically |
no-repeat | The background-image is not repeated |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalhes técnicos
Valor padrão: | repita |
---|---|
Valor de retorno: | Uma String, representando como uma imagem de fundo é repetida |
Versão CSS | CSS1 |
Mais exemplos
Exemplo
Altere a propriedade backgroundRepeat de um elemento DIV especificado:
document.getElementById("myDIV").style.backgroundRepeat = "repeat-x";
Exemplo
Defina uma imagem de fundo para repetir horizontalmente ou verticalmente:
function repeatVer()
{
document.body.style.backgroundRepeat = "repeat-y";
}
function repeatHor() {
document.body.style.backgroundRepeat = "repeat-x";
}
Exemplo
Retorne o valor de repetição em segundo plano de um documento:
alert(document.body.style.backgroundRepeat);
Páginas relacionadas
Tutorial de CSS: Fundo de CSS
Referência CSS: propriedade background-position
Referência CSS: propriedade background-repeat
Referência HTML DOM: propriedade background