在 CSS 中,text-decoration
属性用于控制文本的装饰效果,例如下划线、删除线等。该属性可以应用于任何文本元素,如段落、标题、链接等。
值
text-decoration
属性可以接受以下值:
none
:默认值,文本没有任何装饰效果。underline
:添加下划线。overline
:添加上划线。line-through
:添加删除线。blink
:使文本闪烁。
示例代码
-- ----- -- ---------- - ---------------- ---------- - -- ----- -- --------- - ---------------- --------- - -- ----- -- ------------- - ---------------- ------------- - -- ----- -- ------ - ---------------- ------ -
组合值
text-decoration
属性还可以接受多个值,用空格分隔,可以同时应用多种装饰效果。
-- ----------- -- ----------------------- - ---------------- --------- ------------- -
注意事项
- 不同浏览器对
text-decoration
的支持可能有所不同,特别是对blink
值的支持,因此在使用时需要注意兼容性问题。 - 可以通过
text-decoration-color
和text-decoration-style
属性进一步定制文本装饰效果的颜色和样式。
以上是关于 CSS 属性 text-decoration
的介绍,希望能够帮助您更好地掌握文本装饰效果的应用。