What does it mean when a CSS rule is grayed out in Chrome's element inspector?
For me the current answers didn't explain the issue fully enough, so I am adding this answer which hopefully might be useful to others.
Greyed/dimmed out text, can mean either
- it's a default rule/property the browser applies, which includes defaulted short-hand properties.
- It involves inheritance which is a bit more complicated.
Inheritance
Note: Chrome dev tools "style" panel will display a rule set, because one or more rules from the set are being applied to the currently selected DOM node.
I guess, for the sake of completeness, dev tools shows all the rules from that set, whether they are applied or not.
In the case where a rule is applied to the currently selected element due to inheritance (i.e. the rule was applied to an ancestor, and the selected element inherited it), chrome will again display the entire ruleset.
The rules which are applied to the currently selected element appear in normal text.
If a rule exists in that set but is not applied because it's a non-inheritable property (e.g. background color), it will appear as greyed/dimmed text.
here is an article that give a good explanation - (Note: the relevant item is at the bottom of the article - figure 21 - unfortunately the relevant section doesn't have a heading) -http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art033
Excerpt from the article
This [inheritance scenario] can occasionally create a bit of confusion, because defaulted
short-hand properties; figure 21 illustrates the defaulted short-hand
properties of the font property along with the non-inherited
properties. Just be aware of the context that you're looking at when
examining elements.
What does it mean when Chrome Dev Tools shows a computed property greyed out
NB: This answer has no solid evidence, it's based on my observations along the time.
The gray calculated properties are neither default, nor inherited. This only occurs on properties that were not defined for the element, but calculated from either its children or parent based on runtime layout rendering.
Take this simple page as an example, display
is default and font-size
is inherited:
<style>
div { font-size: 13px; }
</style>
<div>
<p>asdf</p>
</div>
In this particular example, height
is calculated from <p>
's children - text node (font size plus line height), width
is calculated from its parent - <div>
's width, which is also calculated from its parent <body>
.
EDIT: Well I thought again, here's my opinion based answer. I should really go and take a look at Chromium source code later :D
By expanding those arrows, you could see which actual rule is applied to the element, among all those defined against it (either directly or inherited, either by developer or browser):
Here you can trace down to every definition even including browser built-in rules, and check with the CSS cascading (overriding) mechanism.
So, for those elements that have no CSS definition (no directly defined, no inherited, no browser built-in), you don't have any source to trace. And the property values are totally runtime calculated.
If you check Show all, more grayed properties are shown. These are not defined anywhere either. But unlike those in previous screenshots, these are not runtime calculated - they are CSS spec default value.
Why is my CSS rule greyed out even though it's more specific and important doesn't make a difference
For the screenshot you have provided, it looks like you manually added the style, but it doesn't apply to the title div you are currently selecting which lacks the necessary classes, so it is greyed out because that is the element you are inspecting.
What happens when you select the body div or the p element underneath it?
Cant edit CSS STYLE properties (grayed out & blocked) in chrome
Closing the dev tools and opening it again fixes this temporarily. Here's the official bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=796629
Related Topics
100Vw Causing Horizontal Overflow, But Only If More Than One
Can CSS Force a Line Break After Each Word in an Element
Ie11 - Does a Polyfill/Script Exist For CSS Variables
Is There a Sass.Js? Something Like Less.Js
@Font-Face Anti-Aliasing on Windows and Mac
Do I Need to Wrap Quotes Around Font Family Names in Css
Browser Support For CSS Page Numbers
Triangle Shape With Background Image
Resize Font-Size According to Div Size
Show/Hide Div on Click With Css
Css to Make an Empty Cell'S Border Appear
How to Change Btn Color in Bootstrap
Css: 100% Width or Height While Keeping Aspect Ratio
How to Get the Scroll Bar with CSS Overflow on iOS
Hide Div Tag on Mobile View Only
How to Make Google Fonts Work in Ie