CSS lynhoogte eiendom
Voorbeeld
Stel die lynhoogte vir verskillende <div>-elemente:
div.a {
line-height: normal;
}
div.b {
line-height: 1.6;
}
div.c {
line-height:
80%;
}
div.d {
line-height: 200%;
}
Meer "Probeer dit self" voorbeelde hieronder.
Definisie en gebruik
Die line-height
eiendom spesifiseer die hoogte van 'n lyn.
Let wel: Negatiewe waardes word nie toegelaat nie.
Standaard waarde: | normaal |
---|---|
Geërf: | ja |
Animateerbaar: | ja. Lees oor animeerbaar |
Weergawe: | CSS1 |
JavaScript-sintaksis: | voorwerp .style.lineHeight="30px" |
Blaaierondersteuning
Die nommers in die tabel spesifiseer die eerste blaaierweergawe wat die eiendom ten volle ondersteun.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
CSS-sintaksis
line-height: normal|number|length|initial|inherit;
Eiendomswaardes
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 |
Meer voorbeelde
Voorbeeld
Stel die lynhoogte in pixels en sentimeters vir verskillende <div>-elemente:
div.a {
line-height: 10px;
}
div.b {
line-height: 30px;
}
div.c {
line-height:
0.5cm;
}
div.d {
line-height: 1cm;
}
Voorbeeld
Stel die lynhoogte as 'n getal vir verskillende <div>-elemente:
div.a {
line-height: 0.5;
}
div.b {
line-height: 1.6;
}
div.c {
line-height: 2;
}
Verwante bladsye
CSS-tutoriaal: CSS-teks
HTML DOM verwysing: lineHeight eiendom