When to use element.style selector in css?

The following list of selector types is by increasing specificity:

  1. Universal selectors (i.e., *).
  2. Type selectors (e.g., h1) and pseudo-elements (e.g., :before).
  3. Class selectors (e.g., .example), attributes selectors (e.g., >>[type=”radio”]) and pseudo-classes (e.g., :hover).
  4. ID selectors (e.g., #example).

In addition to above selectors, there is a default selector called,

enter image description here

When do we prefer using this selector?

How the CSS specificity rule applies to this selector?


Source: css3

Leave a Reply