CSS - Errors & DevTools

Overview

Estimated time: 10 minutes

Spot common CSS mistakes quickly and use DevTools effectively to diagnose cascade and specificity issues.

Learning Objectives

  • Identify common syntax and cascade errors.
  • Use DevTools to see applied/overridden rules and their specificity.

Details & Examples

Common Errors

  • Missing semicolons in declarations.
  • Typos in property names or values (e.g., backgroud).
  • Unexpected specificity (a more specific rule overrides your change).

DevTools Workflow

  1. Inspect the element and view the Styles panel.
  2. Check which rule is applied/overridden and why.
  3. Toggle properties on/off, edit in place, and copy working rules back to your stylesheet.

Use DevTools to see that the ID rule wins.

Checks for Understanding

  1. Where do you look to see which rule is overriding another in DevTools?
Show answers
  1. The Styles panel shows applied and crossed-out rules with their sources.

Exercises

  1. Use DevTools to identify a rule being overridden and explain why.
  2. Fix a missing semicolon issue and verify the corrected rule takes effect.
Suggested answers
  1. Look at the Styles panel; crossed-out rules show which selector lost; check specificity and source order.
  2. Add the missing ; and watch the cascade update live in DevTools.