温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

css中使用text-decoration的方法

发布时间:2021-02-05 09:20:55 来源:亿速云 阅读:223 作者:小新 栏目:web开发

这篇文章给大家分享的是有关css中使用text-decoration的方法的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

如何使用text-decoration?

使用CSS属性单词:

text-decoration : none || underline || blink || overline || line-through

text-decoration下划线CSS单词值参数:

none :  无装饰

blink :  闪烁

underline :  下划线

line-through :  贯穿线

overline :  上划线

text-decoration:none 无装饰,通常对html下划线标签去掉下划线样式

text-decoration:underline 下划线样式

text-decoration:line-through 删除线样式-贯穿线样式

text-decoration:overline 上划线样式

HTML常规下划线标签

在HTML u标签下划线标签“U”即可对对象文字加html下划线。

实例:

<u>我被U标签加下滑线</u>

CSS控制对象下划线属性样式

html u下划线与CSS下划线对比应用案例

CSS去掉html标签划线样式

如果我们想去掉对应html中删除线s标签删除线样式、去掉html u下划线、去掉html上划线样式。

1、去掉html s删除线贯穿线样式

.p s{text-decoration:none}

去掉p类对象盒子里html s标签样式属性

2、去掉html u下划线样式

.p u{text-decoration:none}

去掉p类对象盒子里u标签下划线线样式属性

五、超链接下划线高级运用 -  TOP

我们接下来为大家讲解常见CSS 超链接,当随便经过时候文字对象被加下划线。

代码如下:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html;
 charset=utf-8" /> 
<title>下划线演示</title> 
<style> 
.yangshi a{ text-decoration:none;}
/* css注释: 鼠标经过热点文字被加下划线 */ 
.yangshi a:hover{ text-decoration:underline;}
/* 鼠标经过热点文字被加下划线 */ 
</style> 
</head> 
<body> 
<p> 
<span class="yangshi"> 
<a href="http:/www.php.cn">p</a> 
</span> 
</p> 
</body> 
</html>

请将以上代码复制新建HTML即可查看该实例样式。

我们进行对3个盒子对象分别设置对象内文字下划线、文字删除线样式、字体上划线样式。

1、css代码片段:

.p{text-decoration:underline}

.p_1{text-decoration:line-through}

.p_2{text-decoration:overline}

2、html代码片段:

<p class="p">我被加下划线</p>

<p class="p_1">我被加贯穿删除线</p>

<p class="p_2">我被加上划线</p>

感谢各位的阅读!关于“css中使用text-decoration的方法”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI