欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 家装 > css 文字下划线 text-decoration

css 文字下划线 text-decoration

2024/10/25 14:34:47 来源:https://blog.csdn.net/weixin_45024453/article/details/139742718  浏览:    关键词:css 文字下划线 text-decoration

背景:

在某些时候需要给文字添加特殊样式。使用 text-decoration: underline; 来为段落文字添加下划线。也有其它文本装饰样式,例如:

  • none:无装饰(去掉装饰)
  • overline:上划线
  • line-through:贯穿线(删除线)

效果展示:

 

样式代码:

cursor: pointer;
color: #2770d4;//一种蓝色
text-decoration: underline;

写到这儿就结束了,下面是扩展:

二、其它

可以使用 text-decoration 的细化属性来更详细地控制下划线的样式,比如颜色、样式和位置:

运行代码:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>CSS 详细控制下划线样式示例</title><style>.custom-underline {text-decoration-line: underline;text-decoration-color: red; /* 设置下划线颜色 */text-decoration-style: dashed; /* 设置下划线样式 */text-underline-position: under; /* 设置下划线位置 */}</style>
</head>
<body><p class="custom-underline">这是带有自定义下划线样式的文字。</p>
</body>
</html>

三、其它2

可以组合这些装饰效果,例如:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>CSS 组合文字装饰示例</title><style>.multiple-decoration {text-decoration: underline overline;}</style>
</head>
<body><p class="multiple-decoration">这是同时带有下划线和上划线的文字。</p>
</body>
</html>

 

 

 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com