CSS -tekstdecoratie- eigenschap
Voorbeeld
Stel verschillende tekstversieringen in voor <h1>, <h2> en <h3> elementen:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
Meer "Probeer het zelf" voorbeelden hieronder.
Definitie en gebruik
De text-decoration
eigenschap specificeert de decoratie die aan tekst wordt toegevoegd en is een verkorte eigenschap voor:
- tekst-decoratie-regel (verplicht)
- tekst-decoratie-kleur
- tekst-decoratie-stijl
Standaardwaarde: | geen huidigekleur effen |
---|---|
geërfd: | Nee |
Animeerbaar: | nee, zie individuele eigenschappen . Lees over animeren |
Versie: | CSS1, vernieuwd in CSS3 |
JavaScript-syntaxis: | object .style.textDecoration="onderstrepen" |
Browserondersteuning
De getallen in de tabel geven de eerste browserversie aan die de eigenschap volledig ondersteunt.
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
CSS-syntaxis
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
Eigendomswaarden
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 |
Meer voorbeelden
Voorbeeld
Voeg meer tekstdecoratie toe:
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
Gerelateerde pagina's
CSS-zelfstudie: CSS-tekst
HTML DOM-referentie: eigenschap textDecoration