text-decoration-line CSS property sets the kind of decoration that is used on text in an element, such as an underline or overline.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead.

句法

/* Single keyword */
text-decoration-line: none;
text-decoration-line: underline;
text-decoration-line: overline;
text-decoration-line: line-through;
text-decoration-line: blink;
/* Multiple keywords */
text-decoration-line: underline overline;               /* Two decoration lines */
text-decoration-line: overline underline line-through;  /* Multiple decoration lines */
/* Global values */
text-decoration-line: inherit;
text-decoration-line: initial;
text-decoration-line: unset;
					

text-decoration-line property is specified as none ,或 one or more space-separated values from the list below.

none

Produces no text decoration.

underline

Each line of text has a decorative line beneath it.

overline

Each line of text has a decorative line above it.

line-through

Each line of text has a decorative line going through its middle.

blink
The text blinks (alternates between visible and invisible). Conforming user agents may simply not blink the text. This value is 弃用 in favor of CSS animations .

形式定义

初始值 none
适用于 所有元素。它还适用于 ::first-letter and ::first-line .
继承 no
计算值 如指定
动画类型 discrete

形式句法

none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error
					

范例

基本范例

<p class="wavy">Here's some text with wavy red underline!</p>
<p class="both">This text has lines both above and below it.</p>
					
.wavy {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: red;
}
.both {
  text-decoration-line: underline overline;
}
					

规范

规范 状态 注释
CSS Text Decoration Module Level 3
The definition of 'text-decoration-line' in that specification.
候选推荐 Initial definition. The text-decoration property is now a shorthand to define multiple related properties.

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
text-decoration-line Chrome 完整支持 57 Edge 完整支持 79 Firefox 完整支持 36
完整支持 36
不支持 6 — 39 Prefixed
Prefixed Implemented with the vendor prefix: -moz-
IE 不支持 No Opera 完整支持 44 Safari 完整支持 12.1 WebView Android 完整支持 57 Chrome Android 完整支持 57 Firefox Android 完整支持 36
完整支持 36
不支持 6 — 39 Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Opera Android 完整支持 43 Safari iOS 完整支持 12.2 Samsung Internet Android 完整支持 7.0
blink 弃用 Chrome 完整支持 57 注意事项
完整支持 57 注意事项
注意事项 blink value does not have any effect.
Edge 完整支持 79 注意事项
完整支持 79 注意事项
注意事项 blink value does not have any effect.
Firefox 完整支持 26 注意事项
完整支持 26 注意事项
注意事项 blink value does not have any effect.
IE 不支持 No Opera 完整支持 44 Safari 完整支持 8 WebView Android 完整支持 57 注意事项
完整支持 57 注意事项
注意事项 blink value does not have any effect.
Chrome Android 完整支持 57 注意事项
完整支持 57 注意事项
注意事项 blink value does not have any effect.
Firefox Android 完整支持 26 注意事项
完整支持 26 注意事项
注意事项 blink value does not have any effect.
Opera Android 完整支持 43 Safari iOS 完整支持 8 Samsung Internet Android 完整支持 7.0 注意事项
完整支持 7.0 注意事项
注意事项 blink value does not have any effect.

图例

完整支持

完整支持

不支持

不支持

弃用。不要用于新网站。

弃用。不要用于新网站。

见实现注意事项。

见实现注意事项。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

  • When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead.

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Text Decoration
  4. 特性
    1. text-decoration
    2. text-decoration-color
    3. text-decoration-line
    4. text-decoration-skip
    5. text-decoration-skip-ink
    6. text-decoration-style
    7. text-decoration-thickness
    8. text-emphasis
    9. text-emphasis-color
    10. text-emphasis-position
    11. text-emphasis-style
    12. text-shadow
    13. text-underline-offset
    14. text-underline-position

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1