Chrome Developer Tools: How to find out what is overriding a CSS rule?
Asked Answered
B

3

213

Well, this is pretty straightforward. If Chrome's Developer Tools is showing me that a style is overridden, how to see what CSS rule is overriding it?

I want to know if is there anything like "Show me what overrides this".

OBS: Please, don't point me to Firebug.

Bengal answered 13/12, 2012 at 19:35 Comment(1)
Chrome's Developer Tools also show you the overriding ruleWicket
S
307

Use the Computed Style panel of the element inspector. Expand the property of interest to see the list of applicable rules, and which one won.

Chrome screenshot

Stochastic answered 13/12, 2012 at 20:3 Comment(7)
For me the computed tab was open at default and therefore not listed as a tab, it should have had a header 'Computed', otherwise you could be looking for a long time.Calvert
The technique has changed a little as Chrome has advanced. Instead of 'Expand the property of interest' click the spy-glass next to the property and it will show which style won back in the Styles tab.Upbear
@intotecho: Chrome 47 has restored the expando in the Computed tab since the magnifying glass change sucked. crbug.com/496263Stochastic
what if ALL of them are cancelled? Probably due to a script? How do you find out who did it?Brain
It's still there as the "Computed" tab on the Elements panel.Stochastic
@josh3736,maybe my css has !important but can't find anything overriding in Computed or elsewhereBonkers
I would avoid trying to use !important to begin with. When you start tossing multiple css libraries into the mix, and then you add your own styling yielding unexpected results, you are in for an action-filled evening.Manley
D
8

You can simply look at the ones with the same name which aren't striked out, remember the listing is by importance.

Or you can view the computed styles. They will be the actually applied styles.

Dett answered 13/12, 2012 at 19:41 Comment(0)
P
2

crtrl + shift + c and inspect the element. Then find the style without a line through it, in the box in the down right corner.

the override is in most cases at the top (and without a line through it, as this style is the "winning" one).

Painless answered 13/12, 2012 at 19:41 Comment(1)
It's not the case when a style is flagged as !importantExpedition

© 2022 - 2024 — McMap. All rights reserved.