Propriedade de altura de linha CSS
Exemplo
Defina a altura da linha 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%;
}
Mais exemplos de "Experimente você mesmo" abaixo.
Definição e uso
A line-height
propriedade especifica a altura de uma linha.
Nota: Valores negativos não são permitidos.
Valor padrão: | normal |
---|---|
Herdado: | sim |
Animavel: | sim. Leia sobre animáveis |
Versão: | CSS1 |
Sintaxe JavaScript: | objeto .style.lineHeight="30px" |
Suporte ao navegador
Os números na tabela especificam a primeira versão do navegador que oferece suporte total à propriedade.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Sintaxe CSS
line-height: normal|number|length|initial|inherit;
Valores de propriedade
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 |
Mais exemplos
Exemplo
Defina a altura da linha em pixels e 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;
}
Exemplo
Defina a altura da linha como um 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
Referência HTML DOM: propriedade lineHeight