Styl agtergrond Herhaal eiendom
Voorbeeld
Stel 'n agtergrondprent om nie te herhaal nie:
document.body.style.backgroundRepeat = "repeat-y";
Meer "Probeer dit self" voorbeelde hieronder.
Definisie en gebruik
Die backgroundRepeat-eienskap stel of gee terug hoe om 'n agtergrondprent te herhaal (teël).
Blaaierondersteuning
Die nommers in die tabel spesifiseer die eerste blaaierweergawe wat die eiendom ten volle ondersteun.
Property | |||||
---|---|---|---|---|---|
backgroundRepeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Sintaksis
Gee die backgroundRepeat-eienskap terug:
object.style.backgroundRepeat
Stel die backgroundRepeat-eienskap:
object.style.backgroundRepeat = "repeat|repeat-x|repeat-y|no-repeat|initial|inherit"
Eiendomswaardes
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 |
Tegniese besonderhede
Standaard waarde: | herhaal |
---|---|
Terugkeerwaarde: | 'n String, wat voorstel hoe 'n agtergrondprent herhaal word |
CSS weergawe | CSS1 |
Meer voorbeelde
Voorbeeld
Verander die backgroundRepeat-eienskap van 'n gespesifiseerde DIV-element:
document.getElementById("myDIV").style.backgroundRepeat = "repeat-x";
Voorbeeld
Stel 'n agtergrondprent om horisontaal of vertikaal te herhaal:
function repeatVer()
{
document.body.style.backgroundRepeat = "repeat-y";
}
function repeatHor() {
document.body.style.backgroundRepeat = "repeat-x";
}
Voorbeeld
Gee die agtergrond-herhaalwaarde van 'n dokument terug:
alert(document.body.style.backgroundRepeat);
Verwante bladsye
CSS-tutoriaal: CSS-agtergrond
CSS verwysing: agtergrond-posisie eiendom
CSS-verwysing: agtergrond-herhaal-eienskap
HTML DOM verwysing: agtergrond eiendom