CSS TutorialLesson #109
CSS Specificity
CSS specificity is an algorithm that determines which style declaration is ultimately applied to an element.
CSS specificity is an algorithm that determines which style declaration is ultimately applied to an element.
If two or more CSS rules point to the same element, the declaration with the highest specificity will "win", and that style will be applied to the HTML element.
Look at the following examples:
Example
Example Code
htmlLive Output Preview:
Now, look at next example:
Example
Example Code
htmlLive Output Preview:
Now, look at next example:
Example
Example Code
htmlLive Output Preview:
Now, look at next example:
Example
Example Code
htmlLive Output Preview:
Interactive Code Examples
CSS Example 1
htmlInteractive runnable CSS example from EA Academy.
Live Output Preview:
CSS Example 2
htmlInteractive runnable CSS example from EA Academy.
Live Output Preview:
CSS Example 3
htmlInteractive runnable CSS example from EA Academy.
Live Output Preview:
CSS Example 4
htmlInteractive runnable CSS example from EA Academy.
Live Output Preview: