如何删除html中链接的下划线
问题描述:
如何从链接中删除下划线?这是我的代码 我尝试在里面输入一些代码,但仍然没有工作如何删除html中链接的下划线
@charset "utf-8";
/* CSS Document */
.top {
color:black;
font-family:Calibri;
text-decoration:none;
}
table {
}
<table>
<tr>
<td><a href="Home.html"><p class="top">Home</p></a></td>
</tr>
</table>
答
你必须设置text-decoration: none
到<a>
标签本身,而不是对<p>
这是它里面。
答
应该是这样的:
a {
text-decoration: none;
}
答
种
我用a
标签更换.top
@charset "utf-8";
/* CSS Document */
a {
color:black;
font-family:Calibri;
text-decoration:none;
}
table {
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css.css">`enter code here`
</head>
<body>
<table>
<tr>
<td><a href="Home.html"><p class="top">Home</p></a></td>
</tr>
</table>
</body>
</html>
答
你.top
类变化为p
标签的风格,但它是a
标记,设置text-decoration
,所以你必须指定或添加到您的a
标签另一个类,并设置它的text-decoration
属性。
一种可能的方法:
<table>
<tr>
<td>
<a href="Home.html" class="no-underline">
<p class="top">Home</p>
</a>
</td>
</tr>
</table>
和
.no-underline {
text-decoration: none;
}