Propiedad lineHeight de estilo
Ejemplo
Establezca la altura de la línea para un elemento <div>:
document.getElementById("myDiv").style.lineHeight = "3";
Definición y uso
La propiedad lineHeight establece o devuelve la distancia entre líneas en un texto.
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad lineHeight:
object.style.lineHeight
Establezca la propiedad lineHeight:
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Valores de propiedad
Value | Description |
---|---|
normal | Normal line height is used. This is default |
number | A number that will be multiplied with the current font size to set the line height |
length | Defines the line height in length units |
% | Defines the line height in % of the current font size |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalles técnicos
Valor por defecto: | normal |
---|---|
Valor de retorno: | Una cadena, que representa la distancia entre líneas en el texto. |
Versión CSS | CSS1 |
Más ejemplos
Ejemplo
Devuelve la altura de línea de un elemento <div>:
alert(document.getElementById("myDiv").style.lineHeight);
páginas relacionadas
Tutorial CSS: Texto CSS
Referencia de CSS: propiedad de altura de línea
❮ Objeto de estilo