[英]Disable :hover state in Chrome Developer Tools
I am aware you can force the :hover
state on an element from the Dev Tools (see eg: See :hover state in Chrome Developer Tools ).我知道您可以从开发工具中强制元素上的
:hover
状态(参见例如: 参见 Chrome 开发者工具中的 :hover 状态)。
I am looking to do the opposite: preventing an element from having the :hover
state applied even though the cursor is over it.我希望做相反的事情:即使光标在元素上,也阻止元素应用
:hover
状态。
That way I could use the element picker on elements that disappear on hover.这样我就可以在悬停时消失的元素上使用元素选择器。
:hover
is in pinned state:hover
处于固定状态时单独禁用样式:hover
state.:hover
状态。 See that the selector and rules that define the :hover
state now appear.:hover
状态的选择器和规则现在出现了。:hover
state.:hover
状态。 You have now disabled some or all of the rules applied to your element's :hover
state.您现在已经禁用了应用于元素的
:hover
状态的部分或全部规则。 You can selectively turn these back on by following the steps above and enabling some or all of the rules.您可以通过执行上述步骤并启用部分或全部规则,有选择地重新启用这些功能。
pointer-events: none
to the target elementpointer-events: none
应用于目标元素element.style
rule to achieve the greatest specificity.element.style
规则来实现最大的特异性。pointer-events: none;
pointer-events: none;
. While enabled, this precludes the invocation of any :hover
rules applied to the target element.启用后,这会阻止调用任何应用于目标元素的
:hover
规则。
Caveat: Because hover events are suppressed, the closest you'll be able to get with the element picker is the target element's parent.警告:因为悬停事件被抑制,您可以使用元素选择器获得的最接近的是目标元素的父元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.