CSS (Cascading Style Sheets) applies style rules to HTML elements selected from the DOM tree.
What the cascade resolves
- Rule origin (browser, user, author).
- Importance (
!important). - Specificity and source order.
Rendered output
A paragraph can inherit font styles from body while receiving color from a class rule.
Important interview questions and answers
- Q: What does “cascading” mean?
A: Multiple matching rules are merged using precedence rules. - Q: What is inheritance in CSS?
A: Some properties naturally flow from parent to child (for example text-related properties). - Q: Why is CSS debugging hard for beginners?
A: Because many rules can apply simultaneously and hide each other.
Pitfall: Check cascade order—author stylesheet loses to inline styles and !important surprises.