Propriété CSS text-decoration
Exemple
Définissez différentes décorations de texte pour les éléments <h1>, <h2> et <h3> :
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
Plus d'exemples "Essayez-le vous-même" ci-dessous.
Définition et utilisation
La text-decoration
propriété spécifie la décoration ajoutée au texte et est une propriété abrégée pour :
- text-decoration-line (obligatoire)
- texte-décoration-couleur
- style de décoration de texte
Valeur par défaut: | aucune couleur actuelle solide |
---|---|
Hérité: | non |
Animable : | non, voir propriétés individuelles . En savoir plus sur l'animation |
Version: | CSS1, renouvelé en CSS3 |
Syntaxe JavaScript : | objet .style.textDecoration="souligner" |
Prise en charge du navigateur
Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge la propriété.
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;
Valeurs de propriété
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 |
Plus d'exemples
Exemple
Ajouter plus de décoration de texte :
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
Pages connexes
Tutoriel CSS : Texte CSS
Référence HTML DOM : propriété textDecoration