Hel*_*ele 2 html css twitter-bootstrap-3
我有以下代码:
<html>
<head>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style>
.nodecor
{
text-decoration: none;
}
.strowb1
{
width: 150px;
height: 35px;
background-color: #1F375F;
text-align: center;
color: #999999;
font-family: calibri;
font-weight: bold;
font-size: 110%;
display: block;
}
.fullcell
{
height: 100%;
width: 100%;
color: #999999;
}
</style>
</head>
<body>
<table>
<tr>
<td class="strowb1">
<a class="nodecor" href="#">
<div class="fullcell">Watch</div>
</a>
</td>
</tr>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
执行时,"Watch"在悬停时具有非常持久的下划线.设置text-decoration: none似乎没有删除它.
我已经尝试在表,tr,td和div上将text-decoration设置为none.
请提出建议.
注意:删除指向引导程序css的链接会删除下划线,但我需要在代码的其他区域中使用它.
您应该提高规则的特异性,因为bootstrap目标a:hover优先.另一个选择是在引导程序之后放置相同的特定规则.如果两个声明具有相同的权重,来源和特异性,则后者指定获胜.
.nodecor:hover {
text-decoration: none;
}
.strowb1 {
width: 150px;
height: 35px;
background-color: #1F375F;
text-align: center;
color: #999999;
font-family: calibri;
font-weight: bold;
font-size: 110%;
display: block;
}
.fullcell {
height: 100%;
width: 100%;
color: #999999;
}Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<table>
<tr>
<td class="strowb1">
<a class="nodecor" href="#">
<div class="fullcell">Watch</div>
</a>
</td>
</tr>
</table>Run Code Online (Sandbox Code Playgroud)
参考:MDN - 特异性 - w3.org - 级联顺序