Learn CSS

A structured guide to CSS, from the cascade and selectors to layout, typography, responsive design, motion, accessibility, and the tools around them.

Start learning CSS

Welcome

Start with what CSS is, how to add it to a page, and the tools you use to write it.

Cascade, Specificity & Inheritance

See how the browser decides which rule wins, and when a value is inherited from a parent.

Selectors

Target elements with type, class, and attribute selectors, plus pseudo-classes, combinators, and nesting.

Units, Values & Functions

Choose units and functions for size, time, and values that adapt to the page.

Box Model

Understand how content, padding, border, and margin form every element's box.

Display & Positioning

Place elements with display, positioning, stacking, and the formatting context around them.

Flexbox

Lay out a row or column of items, then align them and handle the usual flex gotchas.

Grid

Build two-dimensional layouts with tracks, areas, alignment, and subgrid.

Other Layout Systems

Use multi-column layout, tables, and containment when flex or grid is the wrong tool.

Responsive Design

Adapt layout, type, and images to the viewport, the container, and print.

Typography & Fonts

Choose fonts, load them, and control line length, wrapping, and text effects.

Color, Backgrounds & Effects

Work with color, gradients, backgrounds, blend modes, filters, and clipping.

Transforms, Transitions & Animations

Move and animate elements, and respect people who prefer less motion.

Images, Media & Art Direction

Fit images into their boxes and respond to color scheme and pixel density.

Forms & UI Controls

Style form controls, including native widgets and visible focus.

Internationalization

Write styles that follow writing direction with logical properties and writing modes.

Scrolling & Viewport

Control how a page scrolls, snaps, and anchors content in the viewport.

Architecture & Methodologies

Organize stylesheets with naming systems, modules, tokens, and theming.

Tooling

Use preprocessors, PostCSS, build tools, linters, and visual tests around CSS.

Performance

See how CSS is painted and how to keep large pages from doing extra work.

Progressive Enhancement & Compatibility

Support older browsers with feature queries, fallbacks, and a clear compatibility plan.

Houdini & Advanced APIs

Look at the newer CSS APIs for custom properties, typed values, and paint worklets.

Accessibility

Keep focus, contrast, and motion usable for the people reading the page.

Debugging

Inspect layout in DevTools and catch stylesheet mistakes with linters.

Core Rules of Thumb

Keep the cascade predictable, put layout first, and treat accessibility and performance as part of the style.

Appendix

Use the glossary, cheat sheets, and migration notes when you need a reference rather than a lesson.