CSS中可以通过textdecoration属性给文本添加下划线、删除线、过线、波浪线等修饰线,同时还能设置线条的颜色、样式、宽度等样式。/实线下划线/ .text{ textdecoration: ...
CSS中可以通过text-decoration属性给文本添加下划线、删除线、过线、波浪线等修饰线,同时还能设置线条的颜色、样式、宽度等样式。
/*实线下划线*/
.text{
text-decoration: underline;
}
/*虚线下划线*/
.text{
text-decoration: underline dotted;
}
/*双线下划线*/
.text{
text-decoration: underline double;
}
/*实线波浪线*/
.text{
text-decoration: wave;
}
/*过线*/
.text{
text-decoration: line-through;
} 除了以上常用的修饰线样式,CSS还支持自定义样式,可以使用border-bottom属性来实现。例如:
/*虚线下划线*/
.text {
border-bottom: 1px dotted #555;
} 以上就是CSS中列表下划线虚线的基本应用方式,通过text-decoration属性和border-bottom属性可以实现丰富多样的下划线修饰效果。