Propriété CSS line-height
Exemple
Définissez la hauteur de ligne pour différents éléments <div> :
div.a {
line-height: normal;
}
div.b {
line-height: 1.6;
}
div.c {
line-height:
80%;
}
div.d {
line-height: 200%;
}
Plus d'exemples "Essayez-le vous-même" ci-dessous.
Définition et utilisation
La line-height
propriété spécifie la hauteur d'une ligne.
Remarque : Les valeurs négatives ne sont pas autorisées.
Valeur par défaut: | Ordinaire |
---|---|
Hérité: | Oui |
Animable : | Oui. En savoir plus sur l'animation |
Version: | CSS1 |
Syntaxe JavaScript : | objet .style.lineHeight="30px" |
Prise en charge du navigateur
Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge la propriété.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Syntaxe CSS
line-height: normal|number|length|initial|inherit;
Valeurs de propriété
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 |
Plus d'exemples
Exemple
Définissez la hauteur de ligne en pixels et en centimètres pour différents éléments <div> :
div.a {
line-height: 10px;
}
div.b {
line-height: 30px;
}
div.c {
line-height:
0.5cm;
}
div.d {
line-height: 1cm;
}
Exemple
Définissez la hauteur de ligne sous forme de nombre pour différents éléments <div> :
div.a {
line-height: 0.5;
}
div.b {
line-height: 1.6;
}
div.c {
line-height: 2;
}
Pages connexes
Tutoriel CSS : Texte CSS
Référence HTML DOM : propriété lineHeight