Tutorial
-
Web fonts: @font-face, font-display and variable fonts
Load custom fonts, avoid invisible text with font-display, self-host versus Google Fonts, and variable font axes.
-
CSS units: px, em, rem, %, vw and vh
Absolute and relative units, when to use each, and why rem is the usual choice for type.
-
Custom properties (CSS variables)
Define and use custom properties, scope and inheritance, fallbacks, and theming with tokens.
-
The box model: content, padding, border and margin
How every element is a box, how its size is calculated, and margin collapsing.
-
Transitions
Animate state changes smoothly with transition, timing functions, and properties that animate cheaply.
-
box-sizing and controlling element size
border-box versus content-box, width and height, min and max sizes, and the common reset.
-
Keyframe animations and reduced motion
Build multi-step animations with @keyframes, control them with animation properties, and respect prefers-reduced-motion.
-
Display: block, inline and inline-block
How display changes layout behaviour, and a first look at flex and grid values.
-
Transforms: translate, scale and rotate
Move, scale and rotate elements with transforms, the individual transform properties, and transform-origin.
-
Text and font styling
Font families and fallbacks, size, weight, line height, letter spacing and text alignment for readable text.
-
Overflow and scrolling: overflow, scroll snap and smooth scrolling
Handle content that does not fit, truncate text, build scroll-snapping carousels, and control scroll behaviour.
-
Backgrounds, borders and shadows
Background colours and images, gradients, borders, radius and box shadows.
-
Cascade layers with @layer
Organise CSS into layers so resets, frameworks and components stop fighting over specificity.
-
Introduction to Flexbox
Lay out items in a row or column with display: flex, direction, gap and basic alignment.
-
Modern selectors: :has(), :is() and :where()
The parent selector :has(), and :is() and :where() for shorter selectors with controlled specificity.
-
Combinators and attribute selectors
Descendant, child and sibling combinators, and selecting by attribute value.
-
Pseudo-classes and pseudo-elements
Style states like :hover, :focus-visible and :checked, positions like :nth-child, and generated content with ::before and ::after.
-
Flexbox in depth: alignment, wrapping and flex sizing
justify-content, align-items, wrapping, and how flex-grow, flex-shrink and flex-basis share space.
-
Introduction to CSS Grid
Two-dimensional layout with grid-template-columns, rows, the fr unit, gap and placing items.
-
What is CSS? Adding styles to HTML
What CSS does and the three ways to add it to a page: inline, internal and external stylesheets.