propriedade HTML DOM Estilo cssFloat
Definição e Uso
cssFloat conjuntos de propriedades ou retorna o alinhamento horizontal de elementos.
gramática
Definindo as propriedades cssFloat:
Object.style.cssFloat="left|right|none|inherit"
Propriedades volta cssFloat:
Object.style.cssFloat
值 | 描述 |
---|---|
left | 对象/元素浮到父元素的左边 |
right | 对象/元素浮到父元素的右边 |
none | 默认。对象/元素不浮动。 |
inherit | cssFloat 属性的值从父元素继承。 |
Suporte a navegadores
Todos os principais navegadores suportam cssFloat propriedade.
Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".
Dicas e Notas
Nota: Se oespaço é muito pequeno para os fins do elemento flutuante, então este elemento vai saltar para a linha seguinte em uma linha, este processo continuará até que haja uma linha de espaço suficiente.
Exemplos
Exemplos
Clique nos botões para definir a imagem flutua para as bordas esquerda e direita do texto:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
funcionar floatRight () {
. Document.getElementById ( "img1") style.cssFloat = "right";
}
funcionar floatLeft () {
. Document.getElementById ( "img1") style.cssFloat = "left";
}
</ Script>
</ Head>
<Body>
<Img id = "img1" src = "w3javascript.gif" width = "100" height = "132">
<P> Este é um parágrafo. </ P>
<P> Este é um parágrafo. </ P>
<Input type = "button" onclick = "floatRight ()" value = "flutuante right">
<Type = "button" Input onclick = "floatLeft ()" value = "left flutuante">
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
funcionar floatRight () {
. Document.getElementById ( "img1") style.cssFloat = "right";
}
funcionar floatLeft () {
. Document.getElementById ( "img1") style.cssFloat = "left";
}
</ Script>
</ Head>
<Body>
<Img id = "img1" src = "w3javascript.gif" width = "100" height = "132">
<P> Este é um parágrafo. </ P>
<P> Este é um parágrafo. </ P>
<Input type = "button" onclick = "floatRight ()" value = "flutuante right">
<Type = "button" Input onclick = "floatLeft ()" value = "left flutuante">
</ Body>
</ Html>
tente »
estilo Objects