Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 460
Raj Parmar Avatar asked Oct 08 '12 14:10

Raj Parmar


People also ask

How do I save CSS changes of styles panel of Chrome developer tools?

To save your changes, press CTRL + S when editing the file.

How do I fix Chrome developer tools?

# Open the Issues tabOpen DevTools. Click the Go to Issues button in the yellow warning bar. Alternatively, select Issues from the More tools menu. Once you're on the Issues tab, click the Reload page button if necessary.

What does it mean when CSS is crossed out?

If you can see your new CSS in the Styles pane, but your new CSS is crossed out, it means that there's some other CSS that is overriding your new CSS. In CSS terminology this concept is called Specificity. Chrome DevTools can help you find the old CSS that is causing your new CSS to not be applied.


2 Answers

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.

like image 101
Roddy of the Frozen Peas Avatar answered Sep 19 '22 15:09

Roddy of the Frozen Peas


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

like image 34
Buksy Avatar answered Sep 21 '22 15:09

Buksy