css:每一个类支持:hover state? [英] css: does every class support :hover state?
问题描述
如果我使用一个类作为正常的div,我可以写css:
If I use a class for a normal div, can I write the css like:
.messagebc:hover {
...
}
是否合法?
推荐答案
无法使用:hover on non-link elements。
It's ineffiecient to use :hover on non-link elements.
如果你使用:hover on non-anchor
元素,测试IE7中的页面和IE8
以确保您的页面可用。如果
你发现:hover导致
性能问题,考虑
有条件地使用JavaScript
onmouseover事件处理程序为IE
客户端。
If you use :hover on non-anchor elements, test the page in IE7 and IE8 to be sure your page is usable. If you find that :hover is causing performance issues, consider conditionally using a JavaScript onmouseover event handler for IE clients.
:hover伪选择器到非链接元素是一个非常无效的选择器(例如):
例如:
:hover pseudo-selector to non-link elements is a very ineffiecient selector (e.g): For example:
h3:hover {...}
.foo:hover {...}
#foo:hover {...}
div.faa :hover {...}
:hover伪选择器非锚元素已知使IE7和IE8在某些情况下变慢*。当不使用严格的doctype时,IE7和IE8将忽略:hover在锚点之外的任何元素上。当使用严格的doctype时,:hover on non-anchors可能会导致性能下降。
The :hover pseudo-selector on non-anchor elements is known to make IE7 and IE8 slow in some cases*. When a strict doctype is not used, IE7 and IE8 will ignore :hover on any element other than anchors. When a strict doctype is used, :hover on non-anchors may cause performance degradation.
这篇关于css:每一个类支持:hover state?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!