Module 02 of 11

CSS Fundamentals

Lessons

About This Module

Most CSS frustration comes from one question: why isn't my style applying? The answer is almost always found in three ideas — which elements a rule targets, how specific that rule is compared to others, and the order in which the cascade resolves conflicts. Learn these well now and every later module, from layout to animation, gets easier to debug.

This module starts with selectors — element, class, ID, combinators, and attribute selectors — and then adds pseudo-classes and pseudo-elements for styling states like hover and focus, or parts of an element like its first line. It then explains specificity, the scoring system browsers use when two rules compete, and finishes with the cascade and inheritance: how source order, origin, and values passed down from parent elements all combine into the final style you see.

Watch the lessons in order, then continue on to Box Model & Display.

Lessons

4 videos
01

CSS Selectors Tutorial for Beginners

Dave Gray introduces the main types of CSS selectors and how each one targets HTML elements — the vocabulary you need before writing any rule.

02

Pseudo Classes & Elements

The Net Ninja shows how pseudo-classes and pseudo-elements let you style element states and parts of elements, giving you far more power than plain selectors.

03

CSS Specificity Explained

A look at how specificity is calculated from tags, classes, IDs, and inline styles, how !important fits in, and practical advice for avoiding specificity fights.

04

Cascade, Specificity & Inheritance Explained in Depth

Ties it all together: the cascade as the algorithm that resolves conflicting rules, how source order breaks specificity ties, and which properties inherit from parent elements.