Latar belakang gayaUlangi Properti
Contoh
Setel gambar latar ke no-repeat:
document.body.style.backgroundRepeat = "repeat-y";
Lebih banyak contoh "Coba Sendiri" di bawah ini.
Definisi dan Penggunaan
Properti backgroundRepeat menyetel atau mengembalikan cara mengulang (ubin) gambar latar.
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Property | |||||
---|---|---|---|---|---|
backgroundRepeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Sintaksis
Kembalikan properti backgroundRepeat:
object.style.backgroundRepeat
Setel properti backgroundRepeat:
object.style.backgroundRepeat = "repeat|repeat-x|repeat-y|no-repeat|initial|inherit"
Nilai properti
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 |
Detail Teknis
Nilai Bawaan: | ulang |
---|---|
Nilai Kembali: | Sebuah String, mewakili bagaimana gambar latar belakang diulang |
Versi CSS | CSS1 |
Lebih Banyak Contoh
Contoh
Ubah properti backgroundRepeat dari elemen DIV yang ditentukan:
document.getElementById("myDIV").style.backgroundRepeat = "repeat-x";
Contoh
Atur gambar latar untuk diulang secara horizontal atau vertikal:
function repeatVer()
{
document.body.style.backgroundRepeat = "repeat-y";
}
function repeatHor() {
document.body.style.backgroundRepeat = "repeat-x";
}
Contoh
Kembalikan nilai pengulangan latar belakang dokumen:
alert(document.body.style.backgroundRepeat);
Halaman Terkait
Tutorial CSS: Latar Belakang CSS
Referensi CSS: properti posisi latar belakang
Referensi CSS: properti pengulangan latar belakang
Referensi DOM HTML: properti latar belakang