Zum Inhalt springen

CSS-Eigenschaft text-decoration-line

Die Eigenschaft text-decoration-line legt die Art der Linie fest, die für die Textdekoration verwendet wird.

Die Eigenschaft text-decoration-line ist eine der CSS3-Eigenschaften.

Die Eigenschaft text-decoration-line akzeptiert einen oder mehrere Werte.

INFO

Die Eigenschaft text-decoration-line wird in allen modernen Browsern vollständig unterstützt, ohne Vendor-Prefixes.

Anfangswertnone
Gilt fürAlle Elemente. Gilt auch für ::first-letter und ::first-line.
VererbbarNein.
AnimierbarNein.
VersionCSS3
DOM-Syntaxobject.style.textDecorationLine = "overline underline";

Syntax

CSS-Syntax für text-decoration-line

css
text-decoration-line: none | underline | overline | line-through | initial | inherit;

Beispiel für die Eigenschaft text-decoration-line:

CSS-Codebeispiel für text-decoration-line

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        text-decoration-line: overline;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line property example</h2>
    <p>Lorem Ipsum is simply dummy text...</p>
  </body>
</html>

Ergebnis

CSS-Eigenschaft text-decoration-line

Beispiel für die Eigenschaft text-decoration-line mit dem Wert "underline":

CSS-Codebeispiel für text-decoration-line mit dem Wert underline

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        text-decoration-line: underline;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line property example</h2>
    <p>Lorem Ipsum is simply dummy text...</p>
  </body>
</html>

Beispiel für die Eigenschaft text-decoration-line mit dem Wert "line-through":

CSS-Codebeispiel für text-decoration-line mit dem Wert line-through

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        text-decoration-line: line-through;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line property example</h2>
    <p>Lorem Ipsum is simply dummy text...</p>
  </body>
</html>

Beispiel für die Eigenschaft text-decoration-line mit allen Werten:

CSS-Codebeispiel für text-decoration-line mit allen Werten

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

Werte

WertBeschreibungAusprobieren
noneEs wird keine Linie angegeben.Ausprobieren »
underlineGibt eine Linie unter dem Text an.Ausprobieren »
overlineGibt eine Linie über dem Text an.Ausprobieren »
line-throughGibt eine Linie durch den Text an.Ausprobieren »
initialLegt fest, dass die Eigenschaft ihren Standardwert verwendet.Ausprobieren »
inheritErbt die Eigenschaft vom Elternelement.

Die Eigenschaft text-decoration-line unterstützte zuvor einen Wert blink, der Text blinken ließ, dieser Wert ist jedoch jetzt veraltet.

Praxis

Welche davon sind gültige Werte für die 'text-decoration-line'-Eigenschaft in CSS?

Finden Sie das nützlich?

Dual-run-Vorschau — vergleichen Sie mit den Symfony-Routen live.