Mission 3: Command Override

A generic rule is making all text blue, but the '.error-message' class needs to be red for visibility. The class rule isn't working because of specificity.

00:00

Step 1 / 1

System Briefing: The Rule Hierarchy

What happens when multiple CSS rules target the same element? The browser uses a system called Specificity to decide which rule wins. It's a calculated weight that determines the "strength" of a selector.

The Specificity Hierarchy (Highest to Lowest)
  1. Inline Styles: A style applied directly with the style attribute. This is the nuclear option.
  2. ID Selectors: Targeting an element by its unique ID (e.g., #main-nav).
  3. Class, Pseudo-class, Attribute Selectors: Targeting by class (.btn), pseudo-class (:hover), or attribute ([type="text"]).
  4. Type Selectors & Pseudo-elements: Targeting element types (p, div) or pseudo-elements (::before).

Editor