Module 10 of 11

Modern CSS

Lessons

About This Module

CSS has changed a great deal in recent years. Problems that once required a preprocessor, a JavaScript library, or a pile of workarounds can now be solved directly in the browser. Knowing the modern features means writing less code, keeping styles easier to change, and building components that adapt to where they are used rather than only to the size of the screen.

This module starts with custom properties (CSS variables), the foundation for reusable values and themes. It then covers the :has() selector, which lets you style an element based on what it contains, and container queries, which let a component respond to the size of its container instead of the viewport. It finishes with cascade layers, a way to organize your stylesheet and manage specificity, building on what you learned in CSS Fundamentals.

Watch the lessons in order, then continue on to Architecture & Tooling.

Lessons

4 videos
01

CSS Variables Tutorial (CSS Custom Properties)

An introduction to CSS variables, also called custom properties, which give you dynamic, reusable values in plain CSS without a preprocessor.

02

CSS :has Selector Is Amazing!

Dave Gray's tutorial on the :has() selector and how to use it to style elements based on their contents.

03

CSS Container Queries

Explains container queries as a tool for responsive design, and how they differ from media queries by responding to a container rather than the viewport.

04

Managing Specificity with CSS Cascade Layers

An in-depth guide to cascade layers that shows how to write more maintainable stylesheets and deal with specificity more efficiently.