CSS specificity is a measure of how specific a selector is in targeting an HTML element. It determines which styles are applied to an element when there are conflicting rules. Specificity is calculated based on the types of selectors used in the CSS rules, such as element selectors, class selectors, and ID selectors.
In CSS, each selector has a specific weight or value that is used to calculate the specificity of a rule. The following is a breakdown of how selectors are weighted:
1. ID selectors have the highest weight and are given a value of 100.
2. Class selectors, attribute selectors, and pseudo-classes have a weight of 10.
3. Tag name selector
Download
0 formats
No download links available.
Program 1 CSS specificity | CSS interview Questions | CSS Selectors | Selector order | NatokHD