css中hover伪类的bug

在 CSS1 中:hover仅可用于 a 对象。且对于无 href 属性(特性)的 a 对象,此伪类不发生作用。
在 CSS2 中:hover可以应用于任何对象。举个栗子

:hover不生效的代码:

css:

.task-t-l-disable:hover{ color:#999;text-decoration:none;cursor:default;}

html:

                    <a href="javascript:void(0);"class="gray task-t-1-disable"  ms-on-click="showApprovalInfo('isShowExamine')"><i class="iconfont iconfont-user-card f16"></i> 审核详情</a>


虽然以上类task-t-1-disable所在标签仍为a,但只要css处,指定的是给类加伪类,而非给a标签加伪类,则伪类样式不生效。

:hover生效的代码:

css:

        .task-t-l-disable a:hover{ color:#999;text-decoration:none;cursor:default;}

html:


<div class="task-t-1-disable"  >
                    <a href="javascript:void(0);"class="gray"  ms-on-click="showApprovalInfo('isShowExamine')"><i class="iconfont iconfont-user-card f16"></i> 审核详情</a>
</div>
此处由于为了指定某指定位置的a标签样式,而非页面所有html样式,故使用了task-t-1-disable a:hover指定样式,而非直接使用a:hover

你可能感兴趣的:(css中hover伪类的bug)