Chrome developer tools Style tab showing faded CSS definition, why?

14,012

Solution 1

The "faded" styles are ones that are not applied to the selected tag. So in your screenshot, you have an h1 rule which is normal colored -- that one is applied to whatever element you have selected -- and you have an .SubHeader h1 rule that is not being applied to the selected element.

You'll sometimes see this if you dynamically add a CSS rule (the + button in the chrome dev tools) but modify the selector so it doesn't apply to whichever element you have selected.

Solution 2

Rules that are faded are not applied to the element.

Take a look at this example

<!-- HTML -->
<div>
  <span>Test</span>
</div>

/* CSS */
div {
  color: #F0F;
  margin: 15px;
  stroke: #FFF;
  float: left;
}

If you open dev tools, you will notice that margin and float are faded, color and stroke are not. That is because span element inherited style rules from its parent, but only color and stroke rules are inheritable.

dev tools

Solution 3

It means that the rule has been inherited:

http://code.google.com/chrome/devtools/docs/elements-styles.html#computed_style

Solution 4

These are the stylesheets that are applied automatically by the browser.

You can see this by the description: user agent stylesheets.

You can disable this in the setting in the lower right corner by checking Show user agent styles. Now the styles won't be shown in your CSS panel (but are still being applied!)

EDIT:

i misread your question, the dev doc says the following about dimmed rules:

Note: If you edit the selector so that it will not match the selected element, the rule will turn dimmed and obviously, will not be applied to the element. You should rarely need to do this.

Your screenshot looks like this could have been the case.

Share:
14,012

Related videos on Youtube

Raj Parmar
Author by

Raj Parmar

Updated on June 06, 2022

Comments

  • Raj Parmar
    Raj Parmar almost 2 years

    I've been using Chrome for a long time now and I've never (well not that I can recall) come across CSS definitions in the Style panel that are faded. The selector hasn't been defined else where.

    Example:

    enter image description here

    (Edit: Just to be clear, I'm not referring to the user agent stylesheet)

    I can't figure out why it is faded and what this means. The definition appears to be editable but any changes to the values do not persist (i.e. as soon as I click off, it reverts back to original value) and has no effect on the web page.

    I couldn't find any reference to this in the documentation for the tool. Can any of you kind folk shed any light on this?

    • Raj Parmar
      Raj Parmar almost 6 years
      Almost 6 years after asking this question, I've noticed now that the problem I encountered was fixed in later versions of Chrome. The answers below received about why it's faded appear to be correct but in my case I couldn't work out why it was happening to begin with. Turned out to be invalid CSS in definitions before the CSS in the example. (See: jsfiddle.net/bdfEV). The example in the fiddle no longer shows as faded in the current version of Chrome (which appears to now allow spaces in link selectors e.g. "a: hover").
  • Michal Klouda
    Michal Klouda over 11 years
    And why does it display Site.css as source next to them?
  • Giona
    Giona over 11 years
    mmh no, they're under "Matched CSS Rules", you're talking about "Computed Style" which are shaded too, but it's not what OP is talking about.
  • Giona
    Giona over 11 years
    mmh no again, the default color for h1s isn't #7F7F7F
  • Raj Parmar
    Raj Parmar over 11 years
    Hi Christoph, as the others have pointed out, I know about the user agent styles. Perhaps I wasn't clear, but I'm referring to the styles from my own stylesheet (Site.css) which are shaded/faded.
  • BoltClock
    BoltClock over 11 years
    Does Chrome display a rule for an element even if it doesn't match its selector? If so, that'd be weird...
  • Roddy of the Frozen Peas
    Roddy of the Frozen Peas over 11 years
    Chrome allows you to add and modify CSS rules dynamically. If you happen to add a rule that doesn't match your selected element -- or if you modify an existing rule so the selector no longer matches the selected element -- it will show greyed out.
  • Raj Parmar
    Raj Parmar over 11 years
    I follow what you're saying Roddy however, the style in question (.SubHeader h1) hasn't been added dynamically (i.e. it's in the stylesheet and is definitely in effect (i.e. styled as defined). So it is being applied, just Chrome is not letting me modify it.
  • Roddy of the Frozen Peas
    Roddy of the Frozen Peas over 11 years
    Did you try restarting Chrome? That sometimes happens to me for no reason that I can determine -- Chrome just spontaneously decides that it won't let me edit a particular CSS rule.
  • Christoph
    Christoph over 11 years
    @RajParmar can you reproduce your issue (fiddle) and give us the link?
  • Raj Parmar
    Raj Parmar over 11 years
    @Christoph I appreciate what you say but I have not edited anything in the browser at the point the screenshot was taken, if I did, I can understand the reasoning for the fading but this is as loaded.
  • Raj Parmar
    Raj Parmar over 11 years
    Hi Christoph, I've managed recreate it and in the process found what could be causing it but not 100% sure. I found some invalid CSS defined in the same stylesheet which might be causing the problem. See here: jsfiddle.net/bdfEV
  • Roddy of the Frozen Peas
    Roddy of the Frozen Peas over 11 years
    @RajParmar - Yes, it looks like the invalid markup on the link selectors was causing it. Very odd. I've never seen anything like it. I bet it's a Chrome bug -- you should probably submit a bug report and include your Fiddle as proof.
  • drkvogel
    drkvogel about 10 years
    Correct - but it also means that the style is not applicable to the currently selected element.
  • intcreator
    intcreator over 5 years
    This is the most accurate answer, or at least the answer that gives the best explanation.
  • soulsako20
    soulsako20 about 2 years
    This helped me understand it. The answer with the most thumbs up is not complete.