Priority

The priority of the rules depends on their relative specificity. Specificity is computed as three numbers, a - b - c (in a number system with a large base). The number of ID building blocks in the selector gives the first number a , the number of classes, pseudo-classes and attributes gives b , and the number of element types gives c .
The examples in the following table are in priority order, with the most specific first.
Priority Order Example 
Selector
Specificity
#title > #author.full
“2-1-0”
#title
“1-0-0”
P.intro P.citation
“0-2-2”
UL OL LI.red
“0-1-3”
When two rules give the same specificity number, the order of appearance gives the priority (the last seen overrides previous rules).
Priority is used as follows: first the declarations of all rules that match the same objects are merged, and then the priority is applied only if there is a conflict (same key value) within the merged declaration block.