Style lineHeight Proprietà
Esempio
Imposta l'altezza della linea per un elemento <div>:
document.getElementById("myDiv").style.lineHeight = "3";
Definizione e utilizzo
La proprietà lineHeight imposta o restituisce la distanza tra le righe in un testo.
Supporto browser
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà lineHeight:
object.style.lineHeight
Imposta la proprietà lineHeight:
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Valori di proprietà
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 |
Dettagli tecnici
Valore di default: | normale |
---|---|
Valore di ritorno: | Una stringa, che rappresenta la distanza tra le righe nel testo |
Versione CSS | CSS1 |
Altri esempi
Esempio
Restituisce l'altezza della linea di un elemento <div>:
alert(document.getElementById("myDiv").style.lineHeight);
Pagine correlate
Tutorial CSS: testo CSS
Riferimento CSS: proprietà line-height
❮ Oggetto stile