CSS text-decoration 属性
CSS text-decoration 属性
概述
CSS text-decoration 属性定义文本的装饰线,如下划线、删除线、上划线、取代线等。
语法
text-decoration: value;
值
下划线
text-decoration: underline;
删除线
text-decoration: line-through;
上划线
text-decoration: overline;
闪烁
text-decoration: blink;
多重线
text-decoration: double;
无线
text-decoration: none;
继承
text-decoration 属性不继承。
注意事项
- text-decoration 支持多个值同时设置。多个值用空格分隔。
- text-decoration 无法选择颜色、宽度、样式等样式。如果需要更多装饰样式,可以使用特殊字符、伪元素等技术。
示例
p {
text-decoration: underline;
}
h1 {
text-decoration: line-through;
}
a {
text-decoration: none;
}
p {
text-decoration: underline line-through;
}
结论
text-decoration 属性是 CSS 中用于定义文本装饰线样式的属性之一。text-decoration 属性支持多个值同时设置,但无法选择颜色、宽度、样式等样式。如果需要更多装饰样式,可以使用特殊字符、伪元素等技术。