Specificity hierarchy

Every selector has its place in the specificity hierarchy. There are four distinct categories which define the specificity level of a given selector:
  • Inline styles (Presence of style in document)- An inline style is within the XHTML document. It is attached directly to the element to be styled. like <h1 style=”color: #fff;”>.
  • IDs (# of ID selectors) – ID is an identifier for web page elements like #div.
  • Classes, attributes and pseudo-classes – This group includes .classes, [attributes] and pseudo-classes such as :hover, :focus etc.
  • Elements and pseudo-elements – Including elements like :before and :after.

Go To- Certified CSS3 Developer Tutorial

Share this post
[social_warfare]
CSS Specificity: An Overview
Finding Selector’s Specificity

Get industry recognized certification – Contact us

keyboard_arrow_up