Aller au contenu

Propriété CSS text-decoration-style

La propriété text-decoration-style spécifie le style de la décoration de texte. Les styles peuvent être solid, dashed, dotted, double et wavy.

La propriété text-decoration-style fait partie des propriétés CSS3.

Valeur initialesolid
S'applique àTous les éléments. S'applique également à ::first-letter et ::first-line.
HéritéeNon.
AnimableNon.
VersionCSS3
Syntaxe DOMobject.style.textDecorationStyle = "dotted";

Syntaxe

Valeurs CSS text-decoration-style

css
text-decoration-style: solid | double | dotted | dashed | wavy | initial | inherit;

Exemple de la propriété text-decoration-style :

Exemple de text-decoration-style

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-decoration-line: underline;
        text-decoration-style: solid;
        text-decoration-color: #1c87c9;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-style property example</h2>
    <div>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
  </body>
</html>

Résultat

CSS text-decoration-style wavy

Exemple de la propriété text-decoration-style avec la valeur "wavy" :

Exemple de code text-decoration-style wavy

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-decoration-line: underline;
        text-decoration-style: wavy;
        text-decoration-color: #1c87c9;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-style property example</h2>
    <div>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
  </body>
</html>

Exemple de la propriété text-decoration-style avec la valeur "dotted" :

Exemple de code text-decoration-style dotted

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-decoration-line: overline;
        text-decoration-style: dotted;
        text-decoration-color: #1c87c9;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-style property example</h2>
    <div>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
  </body>
</html>

Exemple de la propriété text-decoration-style avec la valeur "dashed" :

Exemple de code text-decoration-style dashed

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-decoration-line: overline;
        text-decoration-style: dashed;
        text-decoration-color: #1c87c9;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-style property example</h2>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
  </body>
</html>

Exemple de la propriété text-decoration-style avec la valeur "double" :

Exemple de code text-decoration-style double

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-decoration-line: overline underline;
        text-decoration-style: double;
        text-decoration-color: #1c87c9;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-style property example</h2>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
  </body>
</html>

Exemple de la propriété text-decoration-style avec toutes les valeurs :

Exemple de toutes les valeurs de text-decoration-style

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        margin: 20px 0;
      }
      div.t1 {
        text-decoration-line: overline underline;
        text-decoration-style: solid;
      }
      div.t2 {
        text-decoration-line: line-through;
        text-decoration-style: wavy;
      }
      div.t3 {
        text-decoration-line: overline underline;
        text-decoration-style: double;
      }
      div.t4 {
        text-decoration-line: overline;
        text-decoration-style: dashed;
      }
      div.t5 {
        text-decoration-line: line-through;
        text-decoration-style: dotted;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-style property example</h2>
    <div class="t1">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
    <div class="t2">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
    <div class="t3">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
    <div class="t4">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
    <div class="t5">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </div>
  </body>
</html>

Valeurs

ValeurDescriptionTester
solidDéfinit une ligne unique. C'est la valeur par défaut de cette propriété.Tester »
doubleDéfinit une double ligne.Tester »
dottedDéfinit une ligne pointillée.Tester »
dashedDéfinit une ligne en tirets.Tester »
wavyDéfinit une ligne ondulée.Tester »
initialDéfinit la propriété à sa valeur par défaut.Tester »
inheritHérite la propriété de son élément parent.

Pratique

Laquelle des valeurs suivantes est une valeur de propriété valide pour 'text-decoration-style' en CSS ?

Trouvez-vous cela utile?

Aperçu dual-run — comparez avec les routes Symfony en production.