Vlastnost výšky řádku CSS
Příklad
Nastavte výšku řádku pro různé prvky <div>:
div.a {
line-height: normal;
}
div.b {
line-height: 1.6;
}
div.c {
line-height:
80%;
}
div.d {
line-height: 200%;
}
Další příklady „Vyzkoušejte si to sami“ níže.
Definice a použití
Vlastnost line-height
určuje výšku čáry.
Poznámka: Záporné hodnoty nejsou povoleny.
Výchozí hodnota: | normální |
---|---|
Zděděno: | Ano |
Animovatelné: | Ano. Přečtěte si o tématu Animable |
Verze: | CSS1 |
Syntaxe JavaScriptu: | objekt .style.lineHeight="30px" |
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která plně podporuje vlastnost.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Syntaxe CSS
line-height: normal|number|length|initial|inherit;
Hodnoty vlastností
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 |
Další příklady
Příklad
Nastavte výšku řádku v pixelech a centimetrech pro různé prvky <div>:
div.a {
line-height: 10px;
}
div.b {
line-height: 30px;
}
div.c {
line-height:
0.5cm;
}
div.d {
line-height: 1cm;
}
Příklad
Nastavte výšku řádku jako číslo pro různé prvky <div>:
div.a {
line-height: 0.5;
}
div.b {
line-height: 1.6;
}
div.c {
line-height: 2;
}
Související stránky
CSS tutoriál: CSS Text
Odkaz HTML DOM: vlastnost lineHeight