3

悬停效果后是否可以使用元素

我试过这样

.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>
                                    &nbsp;-
                                </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">

                                    &nbsp;

                                    &nbsp;

                                    &nbsp;

                                    &nbsp;

                                    &nbsp;

                                    &nbsp;

                                </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>

我做错了什么还是我应该遵循其他方法?

4

3 回答 3

2

http://codepen.io/princemaple/pen/Dcxdi

它完全适合我。
我假设您的某些规则被错误地级联了?
就像您有更具体的定位规则会覆盖此规则...

于 2013-02-23T05:46:29.863 回答
2

试试这个;

tr.GridAlternate td:hover a , tr.GridRowStyle td:hover a{
    color:#fff;
}

并确保将其插入样式表的末尾。也许它正在被其他类覆盖。我希望这有帮助

于 2013-02-23T06:14:38.510 回答
0

你为什么不试试 .tableclass td:hover a { color:#fff; }

于 2013-02-23T05:40:40.650 回答