悬停效果后是否可以使用元素
我试过这个
.tableclass tr td:hover a{
color:#fff;
}
当我将鼠标悬停在td上时,我试图这样做,然后在该td内的锚点链接应该将其颜色更改为白色..
这是我如何尝试自己而不是为我工作?
.GridAlternate td:hover a , .GridRowStyle td:hover a{
color:#fff;
}
我的GridView HTML
<table cellspacing="0" border="1" style="border-collapse:collapse;" id="GV_Users" rules="rows" class="DefaultGridStyle">
<tbody><tr class="GridHeader">
<th scope="col">User Name</th><th scope="col"><a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users','Sort$RoleName')">Role Name</a></th><th valign="middle" align="left" style="width:22%;" scope="col">LogIn</th><th valign="middle" align="center" style="width:33%;" scope="col">Action</th>
</tr><tr class="GridRowStyle">
<td>
Ali Nisarr
</td><td>
Admin
</td><td valign="middle" align="left">
alinisar@ken.com
</td><td valign="middle" align="center">
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl02$Lbtn_change','')" class="editlinkbutton" id="Lbtn_change">Edit</a>
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl02$Lbtn_Remove','')" class="removelinkbutton" id="Lbtn_Remove">Remove</a>
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl02$Lbtn_Disable','')" class="removelinkbutton" id="Lbtn_Disable">Disable</a>
</td>
</tr><tr class="GridAlternate">
<td>
Nizam Ullah
</td><td>
Admin
</td><td valign="middle" align="left">
nizam@ken.com
</td><td valign="middle" align="center">
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl03$Lbtn_change','')" class="editlinkbutton" id="Lbtn_change">Edit</a>
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl03$Lbtn_Remove','')" class="removelinkbutton" id="Lbtn_Remove">Remove</a>
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl03$Lbtn_Disable','')" class="removelinkbutton" id="Lbtn_Disable">Disable</a>
</td>
</tr><tr>
<td colspan="4">
<table class="GridPager">
<tbody><tr>
<td width="7%">
Showing
:
</td>
<td width="5%">
<span id="lbl_rowstartindex">1</span>
-
</td>
<td>
<span id="lbl_rowendindex">2</span>
</td>
<td>
of
</td>
<td>
<span id="lbl_totalrecords">2</span>
</td>
<td width="50%" align="center">
</td>
<td width="18%" align="right">
Displaying per page:
</td>
<td align="left">
<input type="text" id="TxBx_PageSize" maxlength="3" value="10" name="ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl05$TxBx_PageSize">
</td>
<td align="left">
<a href="javascript:__doPostBack('ctl00$CPH_Content$TC_SysUsers$TP_Users$GV_Users$ctl05$lb_Change_RowsPerChange','')" id="lb_Change_RowsPerChange">Change</a>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
我做错了什么或者我应该遵循其他方法吗?
答案 0 :(得分:2)
http://codepen.io/princemaple/pen/Dcxdi
这对我来说完全有用 我假设你的一些规则是错误的级联? 就像您有更具体的定位规则会覆盖此规则...
答案 1 :(得分:2)
试试这个;
tr.GridAlternate td:hover a , tr.GridRowStyle td:hover a{
color:#fff;
}
并确保将其插入样式表的末尾。 也许它被其他类覆盖。 我希望这有帮助
答案 2 :(得分:0)
你为什么不试试.table class td:hover a {color:#fff; }