大网数据广告活动
Web 标准与前端开发

CSS 文本装饰

· 52CE 我爱测

**CSS 文本装饰**(text decoration)模块定义了与文本装饰相关的特性,如下划线、文本阴影和强调标记等。

CSS 文本装饰(text decoration)模块定义了与文本装饰相关的特性,如下划线、文本阴影和强调标记等。

参考

属性

  • text-decoration
  • text-decoration-color
  • text-decoration-line
  • text-decoration-skip
  • text-decoration-skip-ink
  • text-decoration-style
  • text-decoration-thickness
  • text-emphasis
  • text-emphasis-color
  • text-emphasis-position
  • text-emphasis-style
  • text-shadow
  • text-underline-offset
  • text-underline-position

该规范还定义了 text-decoration-skip-box、text-decoration-skip-self、text-decoration-skip-spaces、text-decoration-trim 和 text-emphasis-skip 属性,但目前尚未被任何浏览器支持。

示例

.under {
  text-decoration: underline red;
}

.over {
  text-decoration: wavy overline lime;
}

.line {
  text-decoration: line-through;
}

.plain {
  text-decoration: none;
}

.underover {
  text-decoration: dashed underline overline;
}

.thick {
  text-decoration: solid underline purple 4px;
}

.blink {
  text-decoration: blink;
}
<p class="under">这段文字下方有一条线。</p>
<p class="over">这段文字上方有一条线。</p>
<p class="line">这段文字中间有一条贯穿线。</p>
<p>
  这个
  <a class="plain" href="#">链接将不会显示下划线</a
  >,而链接通常默认是带有下划线的。在为超链接移除文字装饰时请格外小心,因为用户通常依赖下划线来识别超链接。
</p>
<p class="underover">这段文字上方<em>和</em>下方都有线。</p>
<p class="thick">在支持的浏览器中,这段文字下方会有一条非常粗的紫色下划线。</p>
<p class="blink">根据你使用的浏览器,这段文字可能会闪烁。</p>

示例

规范

参见

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。