In the previous tutorials of CSS we have learned about most of the important things about CSS, but the one of the most important thing in creating Style sheets are Cascading, Cascading is one of those things which make CSS even more powerful, when the web writer or user creates an order for the browser to apply the styles and rules in the multiple sheets it is called style sheet cascading. The style sheet or rule that has the highest precedence is the one that is used. The following list is a simplification of how web browser decides for a style to use:
- First look for the Style element that is created for a style sheet and if it is not in the document; use the default rules which are available in the browser.
- See and determine if there are any of the style rules which are marked as important and apply those to the appropriate elements.
- Over the default web browsing any style rules in the document will have precedence.
- The reason for the higher precedence is the more specific style rules.
- In the same element if two rules are applied, the one which will be loaded at the last will have the highest precedence.
Keep reading the tutorials of your first style sheet in CSS next will be coming soon. Thanks!