HTML DOM propiedad Estilo backgroundRepeat
Definición y Uso
backgroundRepeat conjuntos de propiedades o devoluciones como repetir una imagen de fondo.
gramática
Configuración de las propiedades backgroundRepeat:
Object.style.backgroundRepeat="repeat|repeat-x|repeat-y|no-repeat|inherit"
Volver propiedades backgroundRepeat:
Object.style.backgroundRepeat
值 | 描述 |
---|---|
repeat | 默认。垂直和水平方向重复背景图像。 |
repeat-x | 水平方向重复背景图像。 |
repeat-y | 垂直方向重复背景图像。 |
no-repeat | 不重复背景图像。 |
inherit | background-repeat 属性的设置从父元素继承。 |
Soporte para el navegador
Todos los principales navegadores soportan la propiedad backgroundRepeat.
Nota: Internet Explorer 7 y versiones anteriores no son compatibles con el valor "heredar".IE8 sólo proporciona! DOCTYPE apoyado "hereda". apoyo IE9 "hereda".
Ejemplos
Ejemplos
Imagen de fondo repite en la dirección 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 función () {
document.body.style.backgroundRepeat = "repeat-y";
}
</ Script>
</ Head>
<Cuerpo>
<Botón tipo "botón" = onclick = "displayResult ()"> imagen de fondo que se repite verticales </ botón>
<br>
<H1> Hello World! </ H1>
<P> Este es un párrafo </ 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 función () {
document.body.style.backgroundRepeat = "repeat-y";
}
</ Script>
</ Head>
<Cuerpo>
<Botón tipo "botón" = onclick = "displayResult ()"> imagen de fondo que se repite verticales </ botón>
<br>
<H1> Hello World! </ H1>
<P> Este es un párrafo </ p>
</ Body>
</ Html>
Trate »
Objetos de estilo