CSS text-decoration-style 属性设置由属性指定的文本装饰线的样式。
通过属性可以为文本设置下划线、上划线和删除线等装饰线效果。如果某个文本同时设置了多个装饰线效果,再使用 text-decoration-style 属性为它设置装饰线的样式,那么所有装饰线的样式都是相同的。目前不能为同一个元素设置不同样式的装饰线。
通过 text-decoration-style 可以为文本设置实线、点状虚线、虚线、波浪线和双实线样式。如下图所示:
各种文本装饰线样式效果图text-decoration-style 属性可以使用 inherit 值来继承父元素的装饰线样式。
官方语法text-decoration-style: solid | double | dotted | dashed | wavy
参数:
solid :装饰线为一条实线。 double :装饰线为双实线。 dotted :装饰线为点状虚线。 dashed :装饰线为虚线。 wavy :装饰线为波浪线。text-decoration-style 属性的初始值为 solid 。
应用范围text-decoration-style 属性可以应用在所有元素上。
示例代码text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; text-decoration-style: inherit;
为一个元素红色的波浪线样式的下划线:
.example { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: red; }在线演示
下面的例子演示了各种装饰线的样式(只有在Firefox6+浏览器才能够看到效果)。
双实线效果 虚线下划线效果
这是一段带点状虚线下划线效果的文字。
波浪线样式的删除线效果。
浏览器支持目前只有Firefox 6+浏览器才支持 text-decoration-style 属性,需要添加 -moz- 前缀。
查看更多关于text-decoration-style的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did31698