10th Class Computers Science Working with CSS Cascading Order

Cascading Order

Category : 10th Class

*    Cascading Order

 

While using multiple style sheets you need to arrange these sheets in a well define order. The following characteristics will determine the outcome of CSS:  

 

*  ! important

A style that is designated as important will win out over contradictory styles of otherwise equal weight.  

 

* Selector Rules

It is a counting game to calculate the specificity of a selector.

  • Counting the number of HTML tag names in the selector.
  • Counting the number of ID attributes in the selector.
  • Counting the number of CLASS attributes in the selector.  

 

*  Order of Specification

If two rules are the equal weight, the last specified rule wins.  

 

* CSS Grouping

CSS grouping allows you to minimize the code. For this you need to group selectors by separating each selector with comma. The following code snippet shows how to group selectors:

P1, P2, P3

{

color: green;

}


You need to login to perform this action.
You will be redirected in 3 sec spinner