HTML & CSS Masterclass Tutorial

Comprehensive guide to modern HTML and CSS development.

Cascade & Inheritance

Cascade & Inheritance

The Cascade

CSS stands for Cascading Style Sheets. The cascade is the algorithm that dictates how rules cascade down from the top of the stylesheet to the bottom. If two rules have the exact same specificity, the one written last in the stylesheet wins.

Inheritance

Some CSS properties are inherited by child elements from their parent elements. For example, if you set color: blue; and font-family: Arial; on the <body>, all paragraphs, lists, and divs inside the body will inherit that text color and font. However, properties like padding, margin, and border do NOT inherit.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics