Free tutorial · 19 lessons
CSS Tutorial
Learn CSS step by step: selectors, colours, the box model, typography, units, flexbox, grid, positioning, responsive design, pseudo-classes, specificity, variables, dark mode and animations — with live previews you can edit.
CSS Basics
- CSS Introduction — What CSS is, how rules work and how it separates style from content.
- How to Add CSS — External stylesheets, style elements and inline styles — and which to use.
- CSS Selectors — Select elements by type, class, id, attribute, relationship and state.
- CSS Colors — Named colours, hex, rgb, hsl, opacity and modern colour functions.
- CSS Backgrounds and Borders — Background images and gradients, borders, rounded corners and shadows.
- CSS Box Model — Content, padding, border and margin — and box-sizing: border-box.
- CSS Text and Fonts — Fonts, sizes, weights, line height, alignment and web fonts.
- CSS Units — px, %, em, rem, vw, vh and clamp() — when to use which.
- CSS History & Versions — How Håkon Wium Lie proposed CSS in 1994, why there is no "CSS4", every milestone from CSS1 to today's modular CSS on one timeline, and the modern features (Grid, :has(), container queries, nesting) that changed how we style the web.
CSS Layout
- CSS Display — block, inline, inline-block, none — and the layout modes flex and grid.
- CSS Position — static, relative, absolute, fixed and sticky positioning, and z-index.
- CSS Flexbox — One-dimensional layouts: direction, alignment, wrapping, gap and flexible sizes.
- CSS Grid — Two-dimensional layouts with grid-template-columns, fr units, areas and auto-fit.
- CSS Responsive Design — Mobile-first media queries, the viewport meta tag, responsive images and container queries.
Beyond the Basics
- CSS Pseudo-classes and Pseudo-elements — :hover, :focus-visible, :nth-child, ::before, ::after and more.
- CSS Cascade and Specificity — How the browser decides which rule wins.
- CSS Variables and Dark Mode — Custom properties, theming and prefers-color-scheme.
- CSS Transitions and Animations — Smooth state changes with transition, keyframe animations and transforms.
Next Steps
- CSS Next Steps — Frameworks, methodologies and practice projects after the CSS basics.