2016-10-04 54 views
-8

如何从链接中删除下划线?这是我的代码 我尝试在里面输入一些代码,但仍然没有工作如何删除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>

回答

1

你必须设置text-decoration: none<a>标签本身,而不是对<p>这是它里面。

1

应该是这样的:

a { 
    text-decoration: none; 
} 
0

我用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>

2

.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; 
} 
相关问题