03
CSS fundamentals

CSS fundamentals

Selectors, specificity, the box model, units, positioning, and custom properties — the spine every other CSS course assumes.

~ 130 min·8 lessons·updated apr 2026

What you'll learn


Lessons

Read in order. Each lesson stands on its own, but the order is deliberate.

8 lessons · ~130 min total

  1. 01
    What CSS actually is
    A rule is a selector plus a block of property-value pairs. How the browser pairs that rule with an element on the page.
    12 min
  2. 02
    Selectors that pay rent
    Element, class, id, attribute, descendant, child, :hover, :focus, :not — the five or six selectors that do 95% of the work.
    17 min
  3. 03
    Specificity and the cascade
    Why one rule beats another. Origin, specificity, source order, and what !important actually does.
    18 min
  4. 04
    Inheritance and the keyword cascade
    Which properties inherit, which don't, and what inherit, initial, unset, and revert each fix when you reach for them.
    15 min
  5. 05
    The box model
    Content, padding, border, margin — and box-sizing: border-box, the one-line setting that ends an entire class of bugs.
    17 min
  6. 06
    Units that don't lie
    px, em, rem, %, vh/vw/dvh, ch — what each one is measured against, and when each is the right pick.
    18 min
  7. 07
    Positioning and stacking
    static, relative, absolute, fixed, sticky — plus stacking contexts and z-index without the superstition.
    18 min
  8. 08
    Custom properties
    --var, var(), fallbacks, scoping. Why custom properties are not just Sass variables in CSS clothing.
    15 min

Prerequisites

  • · Comfortable writing HTML — tags, attributes, classes
  • · Can open a file in a browser
  • · No JavaScript needed

After this, try