What is specificity?

Question

What is specificity?

Answer

When we have two or more conflicting CSS declarations on the same element, the browser gives the declarations a score (the specificity) to determine which declaration will be applied to the element. The declaration with the higher score will be applied to the element.

2 Likes

What will happen if two classes declare the same property but with different values on an element? Wich one has the higher specificity?

Hello @dodilei! Welcome to the forum.

I answered a similar question a while back: Is it possible for two selectors targeting the same element to have the same specificity? If so, which styles “win” out?

Get HelpCSS

If that doesn’t answer your question, please post again. Happy coding!

3 Likes

Hello! I understood, thank you.

1 Like

can i change size of footer in “p” property also? it is proper step to do ?