HTML DOM Estilo propiedad clear
Definición y Uso
conjuntos de propiedad claros o devuelve la posición del elemento en relación a los objetos flotantes.
gramática
Configuración de las propiedades claras:
Object.style.clear="none|left|right|both|inherit"
Volver atributos claros:
Object.style.clear
值 | 描述 |
---|---|
none | 默认。允许浮动对象出现在元素两侧。 |
left | 不允许浮动对象出现在元素的左侧。 |
right | 不允许浮动对象出现在元素的右侧。 |
both | 不允许浮动对象出现在元素的左侧或右侧。 |
inherit | clear 属性的值应该从父元素继承。 |
Soporte para el navegador
Todos los principales navegadores son compatibles con la propiedad clara.
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
No permita que los objetos flotantes aparecen a la izquierda del texto:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Style type = "text / css">
img {
float: left;
}
</ Style>
<Script>
displayResult función () {
document.getElementById ( "P1") style.clear = "left" .;
}
</ Script>
</ Head>
<Cuerpo>
<Img src = "w3javascript.gif" width = "100" height = "132">
<P id = "p1"> Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. </ P>
<Input type = "button" onclick = "displayResult ()" value = "texto se deja flotando">
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Style type = "text / css">
img {
float: left;
}
</ Style>
<Script>
displayResult función () {
document.getElementById ( "P1") style.clear = "left" .;
}
</ Script>
</ Head>
<Cuerpo>
<Img src = "w3javascript.gif" width = "100" height = "132">
<P id = "p1"> Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto. </ P>
<Input type = "button" onclick = "displayResult ()" value = "texto se deja flotando">
</ Body>
</ Html>
Trate »
Objetos de estilo