Propriété CSS text-decorationProperty
Exemple
Définir la décoration de texte pour les éléments h1, h2, h3 et h4 :
h1 {text-decoration:overline}
h2 {text-decoration:line-through}
h3 {text-decoration:underline}
Essayez-le vous-même »
Définition de l'attribut et instructions d'utilisation
La propriété text-decoration spécifie la décoration ajoutée au texte, comme underline, overline, line-through, etc.
La propriété text-decoration est un raccourci pour les trois propriétés suivantes :
Syntaxe
/*关键值*/ text-decoration: none; /*没有文本装饰*/ text-decoration: underline red; /*红色下划线*/ text-decoration: underline wavy red; /*红色波浪形下划线*/ /*全局值*/ text-decoration: inherit; text-decoration: initial; text-decoration: unset;
| Valeur par défaut : | none |
|---|---|
| Héritée : | non |
| version : | CSS1 |
| Syntaxe JavaScript : | object.style.textDecoration="overline" |
Prise en charge des navigateurs
Les nombres dans le tableau indiquent la première version de navigateur qui prend entièrement en charge la propriété.
| Propriété | |||||
|---|---|---|---|---|---|
| text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Valeur de la propriété
| Valeur | Description |
|---|---|
| none | Par défaut. Définit le texte standard. |
| underline | Définit une ligne sous le texte. |
| overline | Définit une ligne au-dessus du texte. |
| line-through | Définit une ligne qui passe sous le texte. |
| blink | Définit un texte clignotant. |
| inherit | Spécifie que la valeur de la propriété text-decoration doit être héritée de l'élément parent. |
Plus d’exemples
Exemple
h1.under {
text-decoration: underline;
}
h1.over {
text-decoration: overline;
}
p.line {
text-decoration: line-through;
}
p.blink {
text-decoration: blink;
}
a.none {
text-decoration: none;
}
p.underover {
text-decoration: underline overline;
}
Essayez-le vous-même »
Exemple
Ligne en pointillés et ligne ondulée :
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy blue;
}
Essayez-le vous-même »
Articles connexes
Tutoriel CSS :Texte CSS
autres extensions