CSS text-decoration-line 属性值说明

描述
none没有指定行。
underline指定文本下的行。
overline指定文本上的一行。
line-through通过文本指定一行。
initial使属性使用其默认值。
inherit从父母元素继承属性。

除了上述值之外, text-decoration-line 属性还有“blink”值,它使文本闪烁。
此值已弃用。

语法

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

text-decoration-line 属性示例:

<!DOCTYPE html>
<html>
  <head>
    <title>文档的标题</title>
    <style>
      p {
        -webkit-text-decoration-line: overline;
        text-decoration-line: overline;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line 属性示例</h2>
    <p>生活终归还得继续。...</p>
  </body>
</html>

带有“下划线”值的 text-decoration-line 属性示例:

<!DOCTYPE html>
<html>
  <head>
    <title>文档的标题</title>
    <style>
      p {
        -webkit-text-decoration-line: underline;
        text-decoration-line: underline;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line 属性示例</h2>
    <p>生活终归还得继续...</p>
  </body>
</html>

带有“line-through”值的 text-decoration-line 属性示例:

<!DOCTYPE html>
<html>
  <head>
    <title>文档的标题</title>
    <style>
      p {
        -webkit-text-decoration-line: line-through;
        text-decoration-line: line-through;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line 属性示例</h2>
    <p>生活终归还得继续。...</p>
  </body>
</html>

具有所有值的 text-decoration-line 属性示例:

<!DOCTYPE html>
<html>
  <head>
    <title>文档的标题</title>
    <style>
      div {
        margin: 20px 0;
      }
      div.t1 {
        -webkit-text-decoration-line: none;
        text-decoration-line: none;
      }
      div.t2 {
        -webkit-text-decoration-line: underline;
        text-decoration-line: underline;
      }
      div.t3 {
        -webkit-text-decoration-line: line-through;
        text-decoration-line: line-through;
      }
      div.t4 {
        -webkit-text-decoration-line: overline;
        text-decoration-line: overline;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-line 属性示例</h2>
    <div class="t1">
      生活终归还得继续。...
    </div>
    <div class="t2">
      生活终归还得继续。...
    </div>
    <div class="t3">
      生活终归还得继续。,,.
    </div>
    <div class="t4">
      生活终归还得继续。...
    </div>
  </body>
</html>
CSS text-decoration-line 属性

text-decoration-line 属性指定将用于文本装饰的线条类型。

text-decoration-line 属性是 CSS3 属性之一。

text-decoration-line 属性接受一个或者多个值。

Safari 的 -webkit- 扩展与 text-decoration-line 属性一起使用。

初始值none
应用于所有元素。它还适用于伪元素::first-letter 和 ::first-line。
继承无效
可动画的无效
版本CSS3.
DOM 语法object.Style.TextDecorationLine = "overline underline";
日期:2020-06-02 22:14:47 来源:oir作者:oir