A free, step-by-step path to master CSS, from the first selector to modern layout.
Photo by Paula May on Unsplash
CSS looks easy at first. It gets hard when you try to master it, because there are many tutorials but no clear path through them. This curriculum gives you that path. It puts the best free articles, videos, and courses in order, one topic at a time.
- If you are new to the web, start with HTML and CSS basics.
- Follow the stages in order. Each section has two parts: What you will learn and Resources.
- After each stage, build a small page that uses what you learned.
| Icon | Meaning |
|---|---|
| π | Article or documentation |
| πΉ | Video |
| π | Course or video series |
| π©βπ» | Interactive practice |
| π | Book |
| β | Recommended |
| π² | Paid |
| Stage | Sections |
|---|---|
| 0. Start here | HTML and CSS basics |
| 1. Foundations | Syntax Β· Selectors Β· Values and units Β· Custom properties Β· The cascade |
| 2. Boxes and content | Box model Β· Backgrounds and effects Β· Styling content |
| 3. Layout | Layout basics Β· Flexbox Β· Grid Β· Positioning and floats Β· Responsive design |
| 4. Motion | Transitions and animations Β· Shapes |
| 5. Modern CSS | Modern CSS features |
| 6. CSS at scale | Methodologies Β· Preprocessors Β· Frameworks |
| Next | Where to go next |
Learn these basics before you start the curriculum.
- β π Learn CSS - web.dev. A free course and reference for all of CSS.
- π Learn HTML - web.dev.
- π HTML and CSS is hard - A friendly tutorial for complete beginners.
- π CSS styling basics - MDN.
- π Introduction to HTML - Scrimba.
- π Introduction to CSS - Scrimba.
- πΉ HTML Crash Course For Absolute Beginners - Traversy Media.
- πΉ CSS Crash Course For Absolute Beginners - Traversy Media.
A CSS rule has a selector and a declaration block:
- The selector points to the HTML element that you want to style.
- The declaration block holds one or more declarations, separated by semicolons, inside curly braces.
- Each declaration has a property name and a value, separated by a colon.
Selectors choose the HTML elements on the page that a rule styles.
- Simple selectors: element, class, ID, and universal (
*). - Combinators and selector lists:
- Selector list
A, B - Descendant
A B - Child
A > B - Next sibling
A + B - Subsequent sibling
A ~ B
- Selector list
- Attribute selectors:
[type="email"] - Pseudo-classes:
:hover,:focus-visible,:nth-child() - Pseudo-elements:
::before,::after,::placeholder
- β π Selectors - web.dev.
- π Basic CSS selectors - MDN.
- π Attribute selectors - MDN.
- π Pseudo-classes and pseudo-elements - MDN.
- π Combinators - MDN.
- π©βπ» CSS Diner - A game to practice selectors.
Each declaration gives a property a value. Some values are general, such as colors, lengths, and functions like calc(). You will meet the others in later sections.
- Types of values: colors, lengths and numbers, keywords, and functions.
- Units:
px,em,rem,%,vw,vh, andch. - Functions:
calc(),min(),max(), andclamp(). - How the browser processes a value:
- β π Sizing units - web.dev.
- π Color - web.dev.
- π Functions - web.dev.
- π Values and units - MDN.
- π A Nerdβs Guide to Color on the Web - CSS-Tricks.
- π CSS Gradients - CSS-Tricks.
- π A Couple of Use Cases for Calc() - CSS-Tricks.
Custom properties, also called CSS variables, store a value once so that you can use it in many rules.
- Define a custom property:
--brand-color: #0a66c2; - Use it:
color: var(--brand-color); - Give a fallback:
var(--brand-color, blue) - Change it inside a media query or with JavaScript.
- β π A Complete Guide to Custom Properties - CSS-Tricks.
- π Using CSS custom properties - MDN.
- π Learn CSS Variables - Scrimba.
- π Everything you need to know about CSS Variables - freeCodeCamp.
The cascade is the algorithm that picks one value when many rules style the same element. It looks at these, in order:
- Origin and importance: browser styles, user styles, author styles, and
!important. - Cascade layers: rules in a later
@layerwin. - Specificity: the more specific selector wins.
- Order of appearance: if all else is equal, the last rule wins.
- Where CSS comes from: inline
styleattribute,<style>element, external file. - Specificity, from weakest to strongest:
- Universal selector
- Element and pseudo-element selectors
- Class, pseudo-class, and attribute selectors
- ID selector
- Inline style attribute
!important
- Inheritance:
inherit,initial,unset, andrevert.
- β π The cascade - web.dev.
- π Specificity - web.dev.
- π Inheritance - web.dev.
- π Cascade, specificity, and inheritance - MDN.
- π The βCβ in CSS: The Cascade - CSS-Tricks.
- π Inherit, initial, unset, revert - QuirksMode.
- π©βπ» Specificity Calculator
- πΉ CSS Basics (Part 2): Cascades - DevTips.
- πΉ CSS Basics (Part 6): Specificity - DevTips.
The browser draws every element as a rectangular box. The box has four layers: content, padding, border, and margin. You must understand the box model before you build layouts.
- Content: text, images, and other elements.
- Padding: the space between the content and the border.
- Border: the line around the padding.
- Margin: the space outside the border. Learn when margins collapse.
- Box sizing:
content-box: width and height apply to the content only.border-box: width and height include the padding and the border.
- Block and inline boxes.
- β π Box model - web.dev.
- π The box model - MDN.
- π What You Should Know About Collapsing Margins - CSS-Tricks.
- π Inline Elements and Block Elements in HTML - freeCodeCamp.
- Backgrounds: background-color Β· background-image Β· background-size Β· background-repeat Β· background-position Β· background-origin Β· background-clip Β· background-attachment Β· background-blend-mode
- Multiple backgrounds and gradients (linear, radial, and conic).
- Shadows:
box-shadowandtext-shadow. - Clipping and masking:
clip-pathandmask. - Filters:
filterandbackdrop-filter.
- β π Backgrounds and borders - MDN.
- π Every CSS Background Property Illustrated and Explained - freeCodeCamp.
- π Designing Beautiful Shadows in CSS - Josh W. Comeau.
- π Getting Deep Into Shadows - CSS-Tricks.
- π Filters - web.dev.
After the box model, learn to style what goes inside the box: text, lists, links, media, tables, and forms.
- Typography and web fonts
- Lists
- Links
- Images, video, and audio
- Tables
- Forms and buttons
- β π Typography - web.dev.
- π Fundamental text and font styling - MDN.
- π Web fonts - MDN.
- π Styling lists - MDN.
- π Styling links - MDN.
- π Styling tables - MDN.
- π A Complete Guide to the Table Element - CSS-Tricks.
- π Learn Forms - web.dev.
Layout decides where each element sits on the page, how much space it takes, and whether elements sit side by side or stack.
- Normal flow
- The
displayproperty:block,inline,inline-block,flex,grid, andtable. - Multiple-column layout
- Centering
- β π Layout - web.dev.
- π CSS layout - MDN.
- π Learn CSS Layout
- π Centering in CSS: A Complete Guide - CSS-Tricks.
- π When And How To Use CSS Multi-Column Layout - Smashing Magazine.
- πΉ Building layouts with flexbox and CSS grids
Flexbox lays out items in one direction: a row or a column.
- β π An Interactive Guide to Flexbox - Josh W. Comeau.
- β π A Complete Guide to Flexbox - CSS-Tricks.
- π Flexbox - web.dev.
- π Flexbox: The Ultimate CSS Flex Cheatsheet - freeCodeCamp.
- π The Ultimate Guide to Flexbox: Learning Through Examples - freeCodeCamp.
- π Understanding Flexbox: Everything you need to know - freeCodeCamp.
- π The Complete CSS Flex Tutorial
- π Solved by Flexbox
- π©βπ» Flexbox Patterns
- π©βπ» Flexbox Froggy - A game to practice flexbox.
- π What The Flexbox - Wes Bos.
Grid lays out items in two directions: rows and columns at the same time.
- β π An Interactive Guide to CSS Grid - Josh W. Comeau.
- β π A Complete Guide to CSS Grid - CSS-Tricks.
- π Grid - web.dev.
- π The Complete CSS Grid Tutorial
- π How to create an image gallery with CSS Grid - freeCodeCamp.
- π Grid by Example - Rachel Andrew.
- π©βπ» Grid Garden - A game to practice grid.
- π CSS Grid - Wes Bos.
- Position:
static(the default),relative,absolute,fixed, andsticky. - Stacking:
z-indexand stacking contexts. - Floats: text that wraps around an image.
- β π What The Heck, z-index?? - Josh W. Comeau.
- π Positioning - MDN.
- π All About Floats - CSS-Tricks.
- πΉ CSS Positioning, part 1 - DevTips.
- πΉ CSS Positioning, part 2 - DevTips.
- πΉ CSS Floats Explained - DevTips.
- πΉ CSS Floats and Clears Explained - DevTips.
Responsive design uses HTML and CSS to make a page look good on every screen: phones, tablets, and desktops.
-
Media queries
-
Responsive images:
srcset,sizes, and<picture>. -
Fluid sizes with
clamp(). -
Mobile-first and desktop-first layouts.
-
Common responsive patterns:
- Mostly fluid
- Column drop
- Layout shifter
- Off canvas
- β π Learn Responsive Design - web.dev.
- π Responsive design - MDN.
- π Learn CSS Media Queries by Building Three Projects - freeCodeCamp.
- π Learn CSS Flexbox by Building 5 Responsive Layouts - freeCodeCamp.
- πΉ Introduction To Responsive Web Design - Traversy Media.
- π Responsive Web Design Fundamentals - Udacity.
- π Responsive Images - Udacity.
Animations change how an element looks over time.
- Transforms:
translate(),rotate(),scale(),skew(), andtransform-origin. - Transitions: property, duration, timing function, and delay.
- Keyframe animations:
@keyframes, duration, delay, iteration count, direction, and fill mode. - Performance: animate
transformandopacitywhen you can. - Accessibility: respect
prefers-reduced-motion.
- β π An Interactive Guide to CSS Transitions - Josh W. Comeau.
- β π An Interactive Guide to Keyframe Animations - Josh W. Comeau.
- π Animations - web.dev.
- π How to create high-performance CSS animations - web.dev.
- π An Introduction to Web Animations - freeCodeCamp.
- π A Simple CSS Animation Tutorial - freeCodeCamp.
- π©βπ» cubic-bezier.com - Build and test timing functions.
CSS shapes let text flow around a shape that is not a rectangle.
shape-outsidewithcircle(),ellipse(),inset(), andpolygon().- Shapes from an image's alpha channel.
- Shapes from the reference box.
- π CSS shapes - MDN.
- π clip-path - MDN.
All current browsers support these features. Each one replaces a hack or a JavaScript workaround.
| Feature | What it does | Learn it |
|---|---|---|
| Container queries | Style an element based on the size of its container, not the screen | MDN |
:has() |
Select a parent based on its children | MDN |
| Nesting | Write rules inside other rules, like in Sass | MDN |
| Cascade layers | Control which group of styles wins with @layer |
MDN |
| Subgrid | Let a nested grid use the tracks of its parent | MDN |
| Logical properties | Use inline and block instead of left, right, top, and bottom |
MDN |
clamp() |
Set a fluid size with a minimum and a maximum | MDN |
| View transitions | Animate between two states of a page | MDN |
- β π Modern CSS Solutions - Stephanie Eckles.
- π SmolCSS - Small, modern layout snippets.
- π Ahmad Shadeed's blog - Deep, visual articles about new CSS features.
Without rules, CSS gets complex and hard to change. A methodology gives your team one way to name and organize styles.
- BEM - Block, Element, Modifier.
- CUBE CSS - Composition, Utility, Block, Exception.
- OOCSS - Object-oriented CSS.
- SMACSS - Scalable and modular architecture for CSS.
- SUIT CSS
- Atomic CSS (utility classes)
- β π BEM For Beginners: Why You Need BEM - Smashing Magazine.
A preprocessor adds features such as variables, mixins, and functions, then compiles to plain CSS. Sass is the most common one. Native CSS now has variables and nesting, so you need a preprocessor less often than before.
- Sass β
- PostCSS β (a tool that transforms CSS with plugins)
- Less
- Stylus
- β π Sass Basics - Sass documentation.
- π Sass Guidelines - How to write maintainable Sass.
- π Learn Sass In 15 Minutes - Tutorialzine.
- π Sass Tutorial - The Net Ninja.
- πΉ Sass Workflow and Dev Server From Scratch Using Gulp - Traversy Media.
- π PostCSS
- π PostCSS: A Comprehensive Introduction - Smashing Magazine.
Pick a framework after you know plain CSS well. These are the most used ones.
- Tailwind CSS β
- Bootstrap β
- Bulma
- Tailwind CSS
- Bootstrap
- π Bootstrap documentation
- π Bootstrap Framework: Best Practices - Hacker Noon.
- Bulma
- π Bulma documentation
- π Learn Bulma - Scrimba.
- πΉ Bulma Crash Course - Traversy Media.
- β MDN CSS reference
- CSS Reference - A visual guide to CSS properties.
- HTML Reference
- Can I use - Browser support for each feature.
- The Ultimate Guide to Learning CSS
- π The CSS Handbook - freeCodeCamp.
- π² CSS for JavaScript Developers - Josh W. Comeau.
- π² CSS - The Complete Guide (incl. Flexbox, Grid & Sass) - Udemy.
- π² Advanced CSS and Sass: Flexbox, Grid, Animations and More! - Udemy.
- Josh W. Comeau π
- CSS-Tricks π
- Smashing Magazine π
- The CSS Podcast π
- State of CSS - A yearly survey of what developers use.


