Propriété de style lineHeight
Exemple
Définissez la hauteur de ligne d'un élément <div> :
document.getElementById("myDiv").style.lineHeight = "3";
Définition et utilisation
La propriété lineHeight définit ou renvoie la distance entre les lignes dans un texte.
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
Syntaxe
Renvoyez la propriété lineHeight :
object.style.lineHeight
Définissez la propriété lineHeight :
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Valeurs de propriété
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 |
Détails techniques
Valeur par défaut: | Ordinaire |
---|---|
Valeur de retour : | Une chaîne, représentant la distance entre les lignes dans le texte |
Version CSS | CSS1 |
Plus d'exemples
Exemple
Renvoie la hauteur de ligne d'un élément <div> :
alert(document.getElementById("myDiv").style.lineHeight);
Pages connexes
Tutoriel CSS : Texte CSS
Référence CSS : propriété line-height
❮ Objet de style