Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect CSS inheritance source?

Tags:

So far, I can only tell if a property is inherited or not, but I need to know the source of inheritance, (for ex, which CSS file caused the final value ?) is this possible ?

Is there a handy tool for this ?

EDIT

Here is what I get in chrome Computed Style (show inheritance) See the direction property, there is no info about its inheritance source enter image description here

like image 252
simo Avatar asked Dec 28 '12 06:12

simo


People also ask

Which CSS property are inherited?

The inherit CSS keyword causes the element to take the computed value of the property from its parent element. It can be applied to any CSS property, including the CSS shorthand property all . For inherited properties, this reinforces the default behavior, and is only needed to override another rule.

How is CSS inherited?

Inheritance in CSS occurs when an inheritable property is not set on an element. It goes up in its parent chain to set the property value to its parent value. CSS properties such as height , width , border , margin , padding , etc. are not inherited.

How do you find out what is overriding CSS?

The first thing to do is inspect the element and make sure that your new CSS is actually being applied to the nav. 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.

Are all CSS properties inherited?

Only Certain Properties are Inherited The same is true in CSS; not every CSS property is inherited by default by child elements.


1 Answers

You can do this job very easily by using Firebug in Firefox or Chrome's Developer Tools.

Chrome Developer Tools

Like image shows below.

enter image description here

For more information check Chrome Developer Tools: Element Styles Here

In Firebug

Like image shows below.

enter image description here

For more information check CSS Development Here

You can install Fire Bug From Here

Update 1:

You can find it by just clicking Show Inherited check box on Chrome's computed style panel likes below.

enter image description here

Update 2:

In Firebug, you just click inherited element what I showed below image.Then It will guide you to the relevant Inherited element's location.

P.S. - Same can do by using chrome Tool.

enter image description here

like image 177
Sampath Avatar answered Sep 17 '22 06:09

Sampath