HTML DOM propiedad Estilo lineHeight
Definición y Uso
lineHeight conjuntos de propiedades o devuelve la distancia entre filas de texto.
gramática
Configuración de las propiedades lineHeight:
Object.style.lineHeight="normal|number|length|%|inherit"
Volver propiedades lineHeight:
Object.style.lineHeight
值 | 描述 |
---|---|
normal | 默认。设置合理的行间距。 |
number | 设置数字,此数字会与当前的字体尺寸相乘来设置行间距。 |
length | 使用 px、cm 等单位定义行间距。 |
% | 定义行间距为当前字体尺寸的百分比。 |
inherit | lineHeight 属性的值从父元素继承。 |
Soporte para el navegador
Todos los principales navegadores soportan la propiedad lineHeight.
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
Cambiar la altura de la fila:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
displayResult función () {
. Document.getElementById ( "div1") style.lineHeight = "2";
}
</ Script>
</ Head>
<Cuerpo>
<Div id = "div1">
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. Esto es un texto. Esto es un texto.
Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto.
</ Div>
<br>
<Tipo botón = "botón" onclick = "displayResult ()"> Modificar el alto de fila </ botón>
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
displayResult función () {
. Document.getElementById ( "div1") style.lineHeight = "2";
}
</ Script>
</ Head>
<Cuerpo>
<Div id = "div1">
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. Esto es un texto. Esto es un texto.
Esto es un texto. Esto es un texto. Esto es un texto. Esto es un texto.
</ Div>
<br>
<Tipo botón = "botón" onclick = "displayResult ()"> Modificar el alto de fila </ botón>
</ Body>
</ Html>
Trate »
Objetos de estilo