Propiedad de altura de línea CSS
Ejemplo
Establezca la altura de la línea para diferentes elementos <div>:
div.a {
line-height: normal;
}
div.b {
line-height: 1.6;
}
div.c {
line-height:
80%;
}
div.d {
line-height: 200%;
}
Más ejemplos de "Pruébelo usted mismo" a continuación.
Definición y uso
La line-height
propiedad especifica la altura de una línea.
Nota: No se permiten valores negativos.
Valor por defecto: | normal |
---|---|
Heredado: | sí |
Animable: | si. Leer sobre animable |
Versión: | CSS1 |
Sintaxis de JavaScript: | objeto .style.lineHeight="30px" |
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con la propiedad.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Sintaxis CSS
line-height: normal|number|length|initial|inherit;
Valores de propiedad
Value | Description | Play it |
---|---|---|
normal | A normal line height. This is default | |
number | A number that will be multiplied with the current font-size to set the line height | |
length | A fixed line height in px, pt, cm, etc. | |
% | A line height in percent 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 |
Más ejemplos
Ejemplo
Establezca la altura de la línea en píxeles y centímetros para diferentes elementos <div>:
div.a {
line-height: 10px;
}
div.b {
line-height: 30px;
}
div.c {
line-height:
0.5cm;
}
div.d {
line-height: 1cm;
}
Ejemplo
Establezca la altura de la línea como un número para diferentes elementos <div>:
div.a {
line-height: 0.5;
}
div.b {
line-height: 1.6;
}
div.c {
line-height: 2;
}
páginas relacionadas
Tutorial CSS: Texto CSS
Referencia HTML DOM: propiedad lineHeight