去掉a标签的下划线

html-css010

去掉a标签的下划线,第1张

a标签是超链接,它会有下划线。下面,我们来看看如何去掉a标签的下划线吧。

代码,可以看到链接下方有下划线,如下图所示:

<a href="https://www.sogou.com/">souGo</a>

写一个样式表,如下图所示:

<style type="text/css"></style>

然后写超链接样式,如下图所示:

<style type="text/css">

a{

text-decoration:none

}

</style>

显示结果

结果看到超链接下划线已经去掉了,如下图所示:

总代码:

<html>

<body>

<head>

<style type="text/css">

a{

text-decoration:none;

}

</style>

<a href="https://www.sogou.com/">souGo</a>

</head>

</body>

</html>

一组专门的预定义的类称为伪类,主要用来处理超链接的状态。超链接文字的状态可以通过伪类选择符+样式规则来控制。伪类选择符包括:

总: a 表示所有状态下的连接 如 a{color:red}

① a:link:未访问链接 ,如 a:link {color:blue}

② a:visited:已访问链接 ,如 a:visited{color:blue}

③ a:active:激活时(链接获得焦点时)链接的颜色 ,如 a:active{color:blue}

④ a:hover:鼠标移到链接上时 ,如 a:hover {color:blue}

class{text-decoration:none}

class改成你不要下划线样式的名字就行,如果用ID的 #id

a, a:hover, a:focus { text-decoration: nonecolor: inherit} //初始化所有情况下a不要下划线。

下面是关于text-decoration下划线CSS单词值参数:

none :  无装饰

blink :  闪烁

underline :  下划线

line-through :  贯穿线

overline :  上划线

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

text-decoration:underline 下划线样式

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

text-decoration:overline 上划线样式