Suppose we have this style:
.parent .child { ... }
.parent:hover .child { ... }
Both selectors set style for child elements.
What I would like is to edit the second style.
.parent and set :hover state in Chrome developer tools.child element to get to child's style but...When I click on .child the hover on parent is gone (because it's now set on .child).
This works in Firebug though but I need it in Chrome...
Chrome 21.0.1180.89 m
To force an element into :hover state, right click it and select :hover . Additional tips on the elements panel in Chrome Developer Tools Shortcuts. Not sure when this changed, but you can now right click -> force element state (from the elements pane) on other elements (not just <a> elements) now.
Update: Chrome now has the following new hotness:
In the Elements view, right-click the parent element and choose "Force Element State ▶ :hover"
Select the child element in the Elements view again.
Older, valid-but-obnoxious technique follows:
Tested with this JSFiddle:
:hover in it will not go away.)
Note that if you do it wrong in step 3 (if you use the mouse) you have to select a different element first before trying again.
(Chrome 22)
In the Elements panel, right-click the .parent element and select Force Element State > :hover in the context menu. Voila.
Alternatively, you can click the "pointer over a dotted rectangle" button in the Styles pane header at the right and check/uncheck pseudo-classes to be forced on the currently selected element.
Element state can now be forced on any elements in the DOM tree, not only the currently selected one.
When you have the dev tools open and your looking at the style pane on the right side of the header bar where it says Styles, there is a plus button where you can add custom inspector-stylesheet rules. This may be what your looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With