Skip to content

About

A free, step-by-step curriculum to master CSS, from selectors to modern layout.

Topics

Resources

Stars

41 stars

Watchers

3 watching

Forks

Latest commit

Β 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CSS Masterclass Curriculum

A free, step-by-step path to master CSS, from the first selector to modern layout.

Link check Stars

Laptop with code on the screen
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.

How to use this curriculum

  1. If you are new to the web, start with HTML and CSS basics.
  2. Follow the stages in order. Each section has two parts: What you will learn and Resources.
  3. 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

Table of contents

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

HTML and CSS basics

Learn these basics before you start the curriculum.

Back to top ⬆


Stage 1. Foundations

Syntax

A CSS rule: the selector h1, then a declaration block with color and font-size
Image from w3schools

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.

Back to top ⬆

Selectors

Selectors choose the HTML elements on the page that a rule styles.

What you will learn

  • 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
  • Attribute selectors: [type="email"]
  • Pseudo-classes: :hover, :focus-visible, :nth-child()
  • Pseudo-elements: ::before, ::after, ::placeholder

Resources

Back to top ⬆

Values and units

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.

What you will learn

Resources

Back to top ⬆

Custom properties

Custom properties, also called CSS variables, store a value once so that you can use it in many rules.

What you will learn

  • 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.

Resources

Back to top ⬆

The cascade

The cascade is the algorithm that picks one value when many rules style the same element. It looks at these, in order:

  1. Origin and importance: browser styles, user styles, author styles, and !important.
  2. Cascade layers: rules in a later @layer win.
  3. Specificity: the more specific selector wins.
  4. Order of appearance: if all else is equal, the last rule wins.

What you will learn

  • Where CSS comes from: inline style attribute, <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, and revert.

Resources

Back to top ⬆


Stage 2. Boxes and content

Box model

The CSS box model: content, padding, border, and margin
Image from w3.org

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.

What you will learn

  • 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.

Resources

Back to top ⬆

Backgrounds and effects

What you will learn

Resources

Back to top ⬆

Styling content

After the box model, learn to style what goes inside the box: text, lists, links, media, tables, and forms.

What you will learn

  • Typography and web fonts
  • Lists
  • Links
  • Images, video, and audio
  • Tables
  • Forms and buttons

Resources

Back to top ⬆


Stage 3. Layout

Layout basics

Layout decides where each element sits on the page, how much space it takes, and whether elements sit side by side or stack.

What you will learn

  • Normal flow
  • The display property: block, inline, inline-block, flex, grid, and table.
  • Multiple-column layout
  • Centering

Resources

Back to top ⬆

Flexbox

Flexbox lays out items in one direction: a row or a column.

Resources

Back to top ⬆

Grid

Grid lays out items in two directions: rows and columns at the same time.

Resources

Back to top ⬆

Positioning and floats

What you will learn

  • Position: static (the default), relative, absolute, fixed, and sticky.
  • Stacking: z-index and stacking contexts.
  • Floats: text that wraps around an image.

Resources

Back to top ⬆

Responsive design

Responsive design uses HTML and CSS to make a page look good on every screen: phones, tablets, and desktops.

What you will learn

  • Media queries

  • Responsive images: srcset, sizes, and <picture>.

  • Fluid sizes with clamp().

  • Mobile-first and desktop-first layouts.

  • Common responsive patterns:

    Responsive patterns: mostly fluid, column drop, layout shifter, and off canvas

    • Mostly fluid
    • Column drop
    • Layout shifter
    • Off canvas

Resources

Back to top ⬆


Stage 4. Motion

Transitions and animations

Animations change how an element looks over time.

What you will learn

  • Transforms: translate(), rotate(), scale(), skew(), and transform-origin.
  • Transitions: property, duration, timing function, and delay.
  • Keyframe animations: @keyframes, duration, delay, iteration count, direction, and fill mode.
  • Performance: animate transform and opacity when you can.
  • Accessibility: respect prefers-reduced-motion.

Resources

Back to top ⬆

Shapes

CSS shapes let text flow around a shape that is not a rectangle.

What you will learn

  • shape-outside with circle(), ellipse(), inset(), and polygon().
  • Shapes from an image's alpha channel.
  • Shapes from the reference box.

Resources

Back to top ⬆


Stage 5. Modern CSS

Modern CSS features

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

Resources

Back to top ⬆


Stage 6. CSS at scale

Methodologies

Without rules, CSS gets complex and hard to change. A methodology gives your team one way to name and organize styles.

What you will learn

  • 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)

Resources

Back to top ⬆

Preprocessors

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.

What you will learn

  • Sass ⭐
  • PostCSS ⭐ (a tool that transforms CSS with plugins)
  • Less
  • Stylus

Resources

Back to top ⬆

Frameworks

Pick a framework after you know plain CSS well. These are the most used ones.

What you will learn

  • Tailwind CSS ⭐
  • Bootstrap ⭐
  • Bulma

Resources

Back to top ⬆


Where to go next

References πŸ“œ

Courses and books πŸ“€ πŸ“•

Blogs, podcasts, and newsletters πŸ“ πŸŽ™ πŸ“«

Back to top ⬆

About

A free, step-by-step curriculum to master CSS, from selectors to modern layout.

Topics

Resources

Stars

41 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors