Vlastnost CSS text-decoration
Příklad
Nastavte různé dekorace textu pro prvky <h1>, <h2> a <h3>:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
Další příklady „Vyzkoušejte si to sami“ níže.
Definice a použití
Vlastnost text-decoration
určuje dekoraci přidanou k textu a je to zkrácená vlastnost pro:
- text-decoration-line (povinné)
- text-dekorace-barva
- text-decoration-style
Výchozí hodnota: | žádná aktuální barva pevná |
---|---|
Zděděno: | Ne |
Animovatelné: | ne, viz jednotlivé vlastnosti . Přečtěte si o tématu Animable |
Verze: | CSS1, obnoveno v CSS3 |
Syntaxe JavaScriptu: | objekt .style.textDecoration="underline" |
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která plně podporuje vlastnost.
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Syntaxe CSS
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
Hodnoty vlastností
Value | Description |
---|---|
text-decoration-line | Sets the kind of text decoration to use (like underline, overline, line-through) |
text-decoration-color | Sets the color of the text decoration |
text-decoration-style | Sets the style of the text decoration (like solid, wavy, dotted, dashed, double) |
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
Přidejte další textovou výzdobu:
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
Související stránky
CSS tutoriál: CSS Text
Odkaz HTML DOM: vlastnost textDecoration