Inspecting Hover-state in Firebug or Chrome DevTools

社会主义新天地 提交于 2019-11-27 16:24:27

问题


I've got an HTML element that has a CSS hover-state. There's a bug with the margin or padding on hover and every time I mouseover, the contents of the element slide a little, its annoying.

I'd like to debug using FireBug or Chrome Dev Tools, but a common problem I've had with these tools is that after I select the element from Firebug/devtools I obviously need to move the mouse back to the dev tools and the hover state is no longer enabled.

How do I inspect/debug an HTML element using these tools with the element in its hover state?


回答1:


Chrome Dev Tools has a built-in :hover state selector in the Elements > Styles panel. You can toggle other pseudo-classes (like :active) there as well.




回答2:


For testing :hover states in Chrome

For testing :hover state in Firefox (You need firebug add on)




回答3:


Here's a screen shot for firebug & those not sharp enough to see agriboz's comment (like me)




回答4:


Now you can see both the pseudo-class style rules and force them on elements.

To see the rules like :hover in the Styles pane click the small dotted box button in the top right.

To force an element into :hover state, right click the element.

Alternatively, you can use Event Listener Breakpoints sidebar pane in the Scripts panel and select to pause in mouseover handlers.



来源:https://stackoverflow.com/questions/10601431/inspecting-hover-state-in-firebug-or-chrome-devtools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!