CSS 中文字的下划线是一种默认样式,有时候我们并不想要这种样式。下面我们就来介绍一下如何取消 CSS 文字的下划线。/ 取消文字下划线 / textdecoration: none; 上面的代码即为...
CSS 中文字的下划线是一种默认样式,有时候我们并不想要这种样式。下面我们就来介绍一下如何取消 CSS 文字的下划线。
/* 取消文字下划线 */
text-decoration: none; 上面的代码即为取消 CSS 文字下划线的代码。可以应用到任何的文字元素上。如:
p {
text-decoration: none;
}
span {
text-decoration: none;
}
h1 {
text-decoration: none;
} 在上面的代码中,我们分别为 p、span、h1 删除了下划线样式。
除了使用 >text-decoration: none;来去掉文字下划线,还可以使用其他样式来改变下划线样式,如:
/* 将下划线改为波浪线 */
text-decoration: underline wavy;
/* 双下划线 */
text-decoration: underline underline;
/* 点线 */
text-decoration: underline dotted;
/* 修饰线 */
text-decoration: line-through; 上面的代码即为添加不同样式的下划线。
希望上述内容能对您有所帮助,谢谢!