HTML DOM propiedad Estilo cssFloat
Definición y Uso
cssFloat conjuntos de propiedades o devuelve la alineación horizontal de los elementos.
gramática
Configuración de las propiedades cssFloat:
Object.style.cssFloat="left|right|none|inherit"
Volver propiedades cssFloat:
Object.style.cssFloat
值 | 描述 |
---|---|
left | 对象/元素浮到父元素的左边 |
right | 对象/元素浮到父元素的右边 |
none | 默认。对象/元素不浮动。 |
inherit | cssFloat 属性的值从父元素继承。 |
Soporte para el navegador
Todos los principales navegadores soportan la propiedad cssFloat.
Nota: Internet Explorer 7 y versiones anteriores no son compatibles con el valor "heredar".IE8 sólo proporciona! DOCTYPE apoyado "hereda". apoyo IE9 "hereda".
Notas y sugerencias
Nota: Si elespacio es demasiado pequeño para los fines del elemento flotante, entonces este elemento saltará a la siguiente línea en una fila, este proceso continuará hasta que haya una línea de suficiente espacio.
Ejemplos
Ejemplos
Haga clic en los botones para ajustar la imagen flota a los bordes izquierdo y derecho del texto:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
funcionar floatRight () {
. Document.getElementById ( "img1") style.cssFloat = "derecho";
}
funcionar floatLeft () {
. Document.getElementById ( "img1") style.cssFloat = "left";
}
</ Script>
</ Head>
<Cuerpo>
<Img id = "img1" src = "w3javascript.gif" width = "100" height = "132">
<P> Este es un párrafo. </ P>
<P> Este es un párrafo. </ P>
<Input type = "button" onclick = "floatRight ()" value = "flotante derecha">
<Entrada type = "button" onclick = "floatLeft ()" value = "left flotante">
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
funcionar floatRight () {
. Document.getElementById ( "img1") style.cssFloat = "derecho";
}
funcionar floatLeft () {
. Document.getElementById ( "img1") style.cssFloat = "left";
}
</ Script>
</ Head>
<Cuerpo>
<Img id = "img1" src = "w3javascript.gif" width = "100" height = "132">
<P> Este es un párrafo. </ P>
<P> Este es un párrafo. </ P>
<Input type = "button" onclick = "floatRight ()" value = "flotante derecha">
<Entrada type = "button" onclick = "floatLeft ()" value = "left flotante">
</ Body>
</ Html>
Trate »
Objetos de estilo