CSS -text-decoration- Eigenschaft
Beispiel
Legen Sie unterschiedliche Textdekorationen für <h1>-, <h2>- und <h3>-Elemente fest:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
Weitere „Probieren Sie es selbst“-Beispiele weiter unten.
Definition und Verwendung
Die text-decoration
Eigenschaft gibt die dem Text hinzugefügte Dekoration an und ist eine Kurzformeigenschaft für:
- Text-Dekorationszeile (erforderlich)
- Text-Dekoration-Farbe
- Textdekorationsstil
Standardwert: | keine aktuelle Farbe fest |
---|---|
Vererbt: | Nein |
Animierbar: | nein, siehe einzelne Eigenschaften . Lesen Sie mehr über animierbare |
Ausführung: | CSS1, erneuert in CSS3 |
JavaScript-Syntax: | Objekt .style.textDecoration="unterstreichen" |
Browser-Unterstützung
Die Zahlen in der Tabelle geben die erste Browserversion an, die die Eigenschaft vollständig unterstützt.
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
CSS-Syntax
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
Eigenschaftswerte
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 |
Mehr Beispiele
Beispiel
Fügen Sie mehr Textdekoration hinzu:
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
Verwandte Seiten
CSS-Tutorial: CSS-Text
HTML-DOM-Referenz: textDecoration-Eigenschaft