CSS errors are often silent. The browser skips invalid declarations and continues rendering.
Common error patterns
- Misspelled property names.
- Invalid unit-value pairs.
- Unexpected specificity conflicts.
- Rules overridden later in source order.
Debug this snippet
.title {\n colr: red;\n font-weight: 600\n color: #1e3a8a;\n}
Fix: change colr to color and add missing semicolon after font-weight.
Production checklist
- Inspect computed styles for the target element.
- Check which rule actually wins and why.
- Use linting/formatting to catch typos early.
Important interview questions and answers
- Q: Why can valid CSS still not apply?
A: Another rule with higher precedence may override it. - Q: First DevTools panel to inspect?
A: Elements panel with matched/computed styles. - Q: How to reduce CSS regressions?
A: Keep selectors simple, use tokens, and test with representative pages.
Pitfall: Check cascade order—author stylesheet loses to inline styles and !important surprises.