HTML DOM Estilo propriedade clear
Definição e Uso
conjuntos de propriedades claras ou retorna a posição do elemento em relação aos objetos flutuantes.
gramática
Definindo as propriedades claras:
Object.style.clear="none|left|right|both|inherit"
atributos volta claras:
Object.style.clear
值 | 描述 |
---|---|
none | 默认。允许浮动对象出现在元素两侧。 |
left | 不允许浮动对象出现在元素的左侧。 |
right | 不允许浮动对象出现在元素的右侧。 |
both | 不允许浮动对象出现在元素的左侧或右侧。 |
inherit | clear 属性的值应该从父元素继承。 |
Suporte a navegadores
Todos os principais navegadores são suportados pela propriedade clara.
Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".
Exemplos
Exemplos
Não permita flutuar objetos aparecem à esquerda do 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 function () {
document.getElementById ( "P1") style.clear = "left" .;
}
</ Script>
</ Head>
<Body>
<Img src = "w3javascript.gif" width = "100" height = "132">
<P id = "p1"> Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. </ P>
<Input type = "button" onclick = "displayResult ()" value = "text é deixado flutuante">
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Style type = "text / css">
img {
float: left;
}
</ Style>
<Script>
displayResult function () {
document.getElementById ( "P1") style.clear = "left" .;
}
</ Script>
</ Head>
<Body>
<Img src = "w3javascript.gif" width = "100" height = "132">
<P id = "p1"> Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. Este é um texto. </ P>
<Input type = "button" onclick = "displayResult ()" value = "text é deixado flutuante">
</ Body>
</ Html>
tente »
estilo Objects