Promptles
Layout & Responsive Design

CSS Specificity

intermediate

Definition

The browser's rule for deciding which style wins when two CSS rules try to style the same thing: the more precisely a rule points at an element, the more weight it carries.

In the wild

A new rule makes all links blue, but an older rule aimed only at links in the navigation bar makes them red, and because it is more specific the navigation links stay red.

More from Layout & Responsive Design