Sunday, 22 October 2017

CSS- Chaining and Specificity.

Chaining and Specificity

 This CSS selector was more specific than writing only h5. Adding more than one tag, class, or ID to a CSS selector increases the specificity of the CSS selector.
For instance, consider the following CSS:
p { color: blue; } .main p { color: red; }
Both of these CSS rules define what a p element should look like. Since .main p has a class and a p tag as its selector, only the p elements inside the .main element will appear red. This occurs despite there being another more general rule that states p elements should be blue.
Share:
Categories

1 comment: