🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·
🎨Free Course

CSS Styling

Make websites look amazing — colors, layouts, animations, and responsive design.

10 Lessonsbeginner

Lessons

1

What is CSS?

CSS stands for Cascading Style Sheets. It's the language that styles your web pages — colors, fonts, spacing, and layout. HTML is the skeleton, CSS is the skin and clothes! You write CSS rules that say: 'target this element, apply these styles'. One CSS file can control the look of an entire websit…

CSS was created in 1996 — it's older than most developers using it todayThere are over 550 CSS properties; you'll use about 50 regularlyThe cascade and specificity rules are the source of most CSS confusion — understand them early
2

Selectors & Properties

A CSS rule has two parts: a selector (what to target) and declarations (what to change). You can select by tag name (h1), class (.my-class), or ID (#my-id). Classes are the most common — add a class in HTML and style it in CSS. Properties like color, font-size, and background control appearance.

Specificity: IDs (100 points) > classes/pseudo-classes (10 points) > elements (1 point)The universal selector <code>*</code> matches everything — <code>* { box-sizing: border-box }</code>CSS has 50+ pseudo-classes and 15+ pseudo-elements
3

Colors & Backgrounds

CSS gives you many ways to set colors: named colors (red, blue), hex codes (#ff5733), rgb(), or hsl(). Backgrounds can be solid colors, images, or gradients. The linear-gradient() function creates smooth transitions between colors — great for hero sections and buttons.

CSS has 147 named colours — including gems like <code>rebeccapurple</code> (named after a developer's daughter)HSL is easiest for creating colour palettes — keep hue, vary lightness and saturationCSS <code>color-mix(in srgb, red 50%, blue)</code> mixes colours natively (modern CSS)
4

The Box Model

Every HTML element is a box! The CSS box model has four layers: content (the actual text/image), padding (space inside the border), border (the line around it), and margin (space outside the border). Understanding this is key to spacing elements correctly. Use box-sizing: border-box so padding does…

5

Text & Fonts

Typography is huge in design! CSS lets you control font-family (typeface), font-size, font-weight (bold), line-height (spacing between lines), text-align, and text-decoration (underline, strikethrough). Use Google Fonts by adding a link in HTML, then reference the font name in CSS.

<code>font-size: 1rem</code> = browser default (usually 16px) — always use rem for accessibilitySystem font stack: <code>font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif</code> — fast, no downloadFOUT (Flash of Unstyled Text) happens while web fonts load — use <code>font-display: swap</code>
6

Flexbox Layouts

Flexbox makes it easy to arrange items in a row or column. Set display: flex on a container, then control direction, alignment, and spacing. justify-content aligns items along the main axis; align-items aligns along the cross axis. gap adds space between items without needing margins.

<code>flex: 1</code> is shorthand for <code>flex-grow: 1; flex-shrink: 1; flex-basis: 0%</code>Flexbox is 1D; CSS Grid is 2D — use Flexbox for components, Grid for page layouts<code>order</code> property changes visual order without changing DOM order
7

CSS Grid

CSS Grid is perfect for two-dimensional layouts (rows AND columns at once). Define grid columns with grid-template-columns. Use fr units to share available space. gap controls gutters between cells. Grid is ideal for card galleries, page layouts, and dashboards.

CSS Grid is supported in 97%+ of browsersGrid and Flexbox complement each other — use Grid for page layout, Flexbox for component internals<code>auto-fill</code> vs <code>auto-fit</code>: auto-fill keeps empty tracks, auto-fit collapses them
8

Animations & Transitions

CSS can animate elements without JavaScript! transition smoothly changes properties when they change (like on hover). @keyframes defines an animation sequence with from/to or percentage steps. animation: then applies it. Animations make UIs feel alive and fun.

<code>transform</code> and <code>opacity</code> are the two cheapest properties to animateThe <code>will-change: transform</code> hint tells the browser to prepare a GPU layerCSS animations can be paused with <code>animation-play-state: paused</code>
9

Responsive Design & Media Queries

A responsive website looks great on phones, tablets, and desktops. Use media queries to apply different styles at different screen widths. The mobile-first approach starts with small screen styles, then adds @media (min-width) for larger screens. Relative units like %, vw, and rem help elements sca…

Google uses mobile-first indexing — your mobile version is what gets rankedCSS Container Queries (2023) apply styles based on parent width, not viewport<code>clamp(min, val, max)</code> creates fluid sizing without breakpoints
10

CSS Variables & Mini Project

CSS variables (custom properties) let you store values and reuse them everywhere. Define them on :root and use them with var(). Changing one variable instantly updates everything that uses it — great for themes! Let's put everything together and style a mini landing page.

CSS variables are <strong>live</strong> — JavaScript can change them at runtime and the UI updates instantlyUnlike Sass variables, CSS custom properties cascade and can be overridden at any scope levelCSS variables work in <code>calc()</code>: <code>calc(var(--spacing) * 2)</code>

Start learning CSS Styling free today

AI tutoring · quizzes · projects · works on any device