Skip to main content
Module 4 · Lesson 3 of 415/60 in the course~19 min
Module lessons (3/4)

Inheritance, Pseudo-Classes, :is() & :where()

Lesson preview5 hands-on exercises readyModern HTML & CSS · CSS Selectors, Cascade & Specificity

Spot inherited properties vs box properties, style interactive focus states, and keep specificity low with :where().

What you'll learn in this lesson

  • Distinguish inherited properties (color, font-family, line-height) from non-inherited box properties (padding, border, margin, background).
  • Control property inheritance explicitly using inherit, initial, and unset.
  • Style keyboard-accessible focus states cleanly with :focus-visible, select positions via :nth-child, and flatten repeating selectors safely with :is() and zero-specificity :where().

Overview

Set font-family or color once on <body>, and every <p>, <li>, and <h2> inside your document adopts it automatically via CSS Inheritance. Yet put border: 1px solid on <main>, and children do not suddenly sprout borders—that would ruin every layout!

Sections covered in this lesson

  1. 1What Flows Down the DOM Tree (And What Doesn't)
  2. 2Modern Pseudo-Classes & Zero-Specificity Wrappers
Pro Lesson · CSS Selectors, Cascade & Specificity

Unlock "Inheritance, Pseudo-Classes, :is() & :where()" and the full Modern HTML & CSS curriculum

Spot inherited properties vs box properties, style interactive focus states, and keep specificity low with :where().

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Modern HTML & CSS plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.