CSS Cascading Order

CSS Cascading Order


CSS Cascading Order
In a web page the style sheets may be attached the following way -
  1. linked
  2. imported
  3. embedded
Styles may also be declared inline in the HTML.
There are many browsers that allow users to have their own style sheets that can override yours in a web page. 
It’s guaranteed, of course, that simultaneous style sheets from two or more sources will have conflicting declarations. 
Now the question is which comes out on top lets find out - 
Cascading order in CSS refers to the way styles begin at the top of the page. 
And, as they cascade down, collect and replace each other as they are inherited. 
Thumb rule is that the last style defined is the one that is used.
However, at times, two or more styles will conflict. 
Use the following procedure to determine which style will come out on top and be applied to a given element.
Determining the cascade-order value for an element - 
Collect all styles that will be applied to the element. 
Find all the applied, inherent, and inherited styles that will be applied to the element.
Now use the following criteria to determine which styles are applied in the cascade order.
Criteria being top to bottom, top being important -