Skip to content
Pebellslearn by building

The course

CSS

Learn how CSS attaches to HTML, how a rule is built, how selectors pick exactly the elements you mean, and how the cascade settles conflicts. You finish by setting type that is comfortable to read.

Ready to learn

Your path through the ideas

Inside the course

7 modules · 24 lessons
CLI tools & setup · Start here

Install your tools, choose your setup and verify a local run.

02Introduction3 lessons

CSS is a language for describing how structured documents are presented, including their layout, typography and color. Meet the café page you will style for the whole course, see why CSS can only style what HTML has named, and learn how the three frontend languages divide the work.

  1. 01HTML — The Structure CSS Styles12 min
  2. 02CSS — The Presentation Layer12 min
  3. 03JavaScript and the Frontend12 min
03CSS Basics4 lessons

CSS declarations can be attached inline, embedded in a document or linked in a stylesheet. The cascade resolves competing declarations. Attach styles inline, inside a style element and from an external file, learn when each one fits, and then predict which declaration wins when several target the same element.

  1. 01Inline CSS12 min
  2. 02Internal CSS12 min
  3. 03External CSS12 min
  4. 04Cascading Order15 min
04Rules3 lessons

A CSS rule pairs a selector with declarations. The selector chooses elements; each declaration supplies a property and value. Learn the shape of every CSS rule, the kinds of values properties accept, why the browser silently skips mistakes, and how to leave comments that help the next reader.

  1. 01Selectors and Declarations12 min
  2. 02Properties and Values12 min
  3. 03Comments12 min
05Simple Selectors5 lessons

A simple selector matches an element by a characteristic such as its type, class, ID or attribute. Select by element type, class, id and attribute, group selectors with commas, and learn how much weight each kind carries when rules compete.

  1. 01Element and Universal Selectors12 min
  2. 02Class Selectors12 min
  3. 03Id Selectors12 min
  4. 04Grouping Selectors12 min
  5. 05Attribute Selectors12 min
06Combinator Selectors4 lessons

A combinator joins selectors through a relationship in the document tree, such as ancestry or sibling order. Combine selectors to reach elements through their family relationships: anywhere inside, directly inside, right after and anywhere after.

  1. 01The Descendant Combinator12 min
  2. 02The Child Combinator12 min
  3. 03The Next-Sibling Combinator12 min
  4. 04The Subsequent-Sibling Combinator15 min
07Fonts and Text Styling5 lessons

Font properties choose and size glyphs. Text properties control how those glyphs are arranged, spaced and aligned. Choose font stacks and web fonts, size text in units that respect the reader, use weights, styles and the font shorthand safely, then control colour, alignment, line height and spacing.

  1. 01Font Families and Web Fonts12 min
  2. 02Font Size and Weight12 min
  3. 03Font Style, Variant and the Shorthand12 min
  4. 04Colour, Alignment and Direction12 min
  5. 05Line Height and Text Spacing15 min
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.