Interactive roadmap
CSS roadmap
This roadmap is for beginners who want to design beautiful, responsive web pages. You will learn how to style HTML elements, control layouts, and add smooth animations.
- 1
Selectors and The Cascade
0 of 4 done
Learn how to target HTML elements and understand how styles are applied.
Take your time with selectors; getting comfortable targeting elements is the foundation of all web styling. - 2
The Box Model and Sizing
0 of 4 done
Master spacing, borders, and how elements take up room on the page.
Visualise every HTML element as an invisible parcel box to make spacing and sizing much easier to manage. - 3
Typography and Colour
0 of 3 done
Make your text readable and your designs pop with great colours.
Keep colour palettes simple and text contrast high to make your website readable for everyone. - 4
Flexible Layouts with Flexbox
0 of 3 done
Line up items easily in rows or columns and control their spacing.
Flexbox is your best friend for aligning items in one direction, whether in rows or columns. - 5
Page Layouts with CSS Grid
0 of 3 done
Build complex multi-column page layouts with rows and columns.
Use CSS Grid when you need to control both rows and columns at the same time for full page layouts. - 6
Responsive Design and Animation
0 of 4 done
Make your sites look great on phones and add interactive motion.
Always test your designs by resizing your browser window to ensure your mobile views look just as good as desktop.
Learn it all, with a tutor that never sleeps
Every topic links to LevelUp lessons, practice exercises and the 24/7 AI Tutor. Your progress updates as you master lessons.
Every topic explained
Step 1: Selectors and The Cascade
- Understand how to write basic style rules using selectors and declarations to change how your page looks.MDN CSS First Steps
Read more
CSS rules are the instructions you write to tell the browser how to style your HTML. Every rule consists of a selector, which picks out the element you want to change, and a declaration block that lists your chosen property and value pairs.
Imagine you are decorating a room and want to paint a specific chair bright blue. The chair is your selector, the paint is the property, and blue is the value. By combining these rules, you transform a plain text document into a colourful, structured design.
Learning this core syntax is essential because every single web page you build relies on these rules to apply visual styles and bring your layouts to life.
- Selectors choose which HTML elements to style
- Declarations contain properties and values
- Each declaration ends with a semicolon
- Rules are wrapped in curly braces
- Discover how the browser decides which conflicting style to use and how values flow down from parent elements.
Read more
The cascade is the set of rules browsers use to resolve conflicts when multiple styles apply to the same element. It looks at factors like source order, specificity, and importance to decide which rule wins.
Think of it like a family recipe where newer notes override older instructions. Inheritance means that certain properties, such as font style or text colour, automatically flow down from parent elements like body tags to children paragraphs inside them.
Understanding this behaviour stops your styles from fighting each other unexpectedly, helping you write cleaner and more predictable stylesheets.
- Conflicts are resolved by specificity and order
- Later rules in your file override earlier ones
- Some properties inherit from parent elements
- Not all properties pass down by default
- Use classes and IDs to target specific elements on your page without affecting everything else.
Read more
Classes and IDs are custom attributes you add to HTML elements so you can target them precisely with CSS. Classes can be reused across many different elements on a page, while IDs must be unique to a single element.
Think of a class like a uniform worn by multiple team members, whereas an ID is like a passport number belonging to just one person. You use a dot for classes and a hash symbol for IDs in your stylesheet.
Mastering these selectors allows you to style specific buttons, navigation bars, or headings without accidentally changing every single element of that type on your site.
- Use classes for reusable groups of styles
- Use IDs for unique, one-off page elements
- Classes start with a dot in CSS
- IDs start with a hash symbol in CSS
- (optional)
- Style elements based on their state, such as when a user hovers over a link or clicks a button.
Read more
Pseudo-classes are special keywords added to selectors that let you style elements based on their current state or position. They allow your site to react dynamically when users interact with the page.
Picture a shop door sensor that turns on a welcome light the moment a customer steps close to it. Similarly, a pseudo-class applies styles when a user hovers a mouse over a link, clicks a button, or selects a form field.
Using these states is vital for user experience, giving visitors instant visual feedback that buttons are clickable and links are interactive.
- Written with a colon before the keyword
- Hover changes style when mouse passes over
- Focus tracks active form input fields
- Improves interactivity and user feedback
Step 2: The Box Model and Sizing
- Learn how content, padding, borders, and margins create the box around every HTML element.
Read more
The box model is the foundational concept that every HTML element is treated as a rectangular box. It consists of four distinct layers: content, padding, borders, and margins, working together to dictate spacing.
Think of a framed picture on your wall. The picture itself is the content, the white mount board is the padding, the wooden frame is the border, and the space between frames on the wall is the margin.
Getting to grips with the box model is crucial because unexpected spacing issues on your website almost always stem from misunderstanding how these four layers add up.
- Content sits at the very centre
- Padding creates space inside the border
- Borders wrap around the padding
- Margins create space outside the element
- Control the size of your boxes using pixels, percentages, and other handy units.
Read more
Sizing properties let you explicitly control the width and height of element boxes on your web page. You can use fixed units like pixels or flexible units that adapt to screen sizes.
Imagine tailoring a jacket; you measure the exact width across the shoulders and the length of the sleeves to ensure a comfortable fit. Sizing rules do the exact same thing for web containers and images.
Precise sizing ensures your images do not overflow their containers and your layout components maintain clean, balanced proportions across different desktop and mobile displays.
- Pixels provide fixed, exact dimensions
- Percentages scale relative to parent containers
- Max width prevents elements getting too wide
- Min height ensures content areas have presence
- Switch between block and inline elements to change how they flow across the page.
Read more
The display property determines how an element behaves in the document flow, specifically whether it sits on its own line or flows alongside other items. The two most common values are block and inline.
Think of block elements like heavy moving boxes that stack vertically on top of each other, while inline elements are like words in a sentence flowing horizontally side by side.
Knowing how to switch display types gives you fundamental control over how page elements arrange themselves before you even touch advanced layout systems like Flexbox.
- Block elements take up the full width
- Inline elements only take up needed space
- Block elements start on a new line
- Inline elements flow within text lines
- (optional)
- Manage content that spills outside of its designated box using scrollbars or hidden clipping.
Read more
Overflow happens when content is too large to fit inside its designated container box. CSS overflow properties tell the browser how to handle this excess text or imagery.
Imagine stuffing too many jumpers into a small suitcase; you either need to zip it shut and hide the bulge, or add a shelf inside to let people scroll through the extra items.
Managing overflow keeps your layouts tidy and stops unruly content from spilling out and breaking the visual structure of your carefully designed web pages.
- Visible leaves content spilling outside
- Hidden clips away any excess content
- Scroll adds scrollbars to the container
- Auto adds scrollbars only when needed
Step 3: Typography and Colour
- Change font families, sizes, weights, and line heights to make your words easy to read.
Read more
Text styling properties allow you to control font families, sizes, weights, and line heights across your website. Good typography is the backbone of clear communication on the internet.
Think of choosing fonts for a book publication; you select a clean typeface for chapters, make headings bolder, and ensure lines are spaced out enough to prevent eye strain.
Mastering text styles ensures your content is not only legible and accessible, but also establishes a professional tone that matches the personality of your brand or project.
- Font family sets the typeface style
- Font weight controls how bold text appears
- Line height improves readability of paragraphs
- Font size scales your text hierarchy
- Apply background and text colours using names, hex codes, and RGB values.
Read more
Colour properties bring life to your designs by setting backgrounds, text, and border hues. CSS supports simple colour names, precise hex codes, and flexible RGB values.
Think of mixing paints on a palette before applying them to a canvas to create a consistent and welcoming atmosphere in a room.
Applying thoughtful colour choices helps guide user attention towards important buttons and headers while building a cohesive visual identity for your web pages.
- Hex codes use hash symbols and six digits
- RGB values mix red, green, and blue light
- Color property changes text colour
- Background color fills container spaces
- (optional)
- Add smooth colour transitions to your backgrounds without needing image files.
Read more
Background gradients let you create smooth, multi-colour transitions directly in CSS without needing to download external image files. They add modern depth to buttons and headers.
Think of a sunset blending gradually from orange to deep purple across the evening sky. A CSS gradient paints your elements in a similar seamless fashion.
Using gradients keeps your web pages lightweight and fast-loading while giving you the flexibility to update your colour schemes instantly in code.
- Linear gradients flow along a straight line
- Radial gradients radiate outward from a point
- Can include multiple stop colours
- Saves loading time over image files
Step 4: Flexible Layouts with Flexbox
- Turn on Flexbox to easily align items horizontally or vertically inside a container.
Read more
Flexbox is a powerful one-dimensional layout model that makes it simple to align items horizontally or vertically. Turning on a flex container instantly arranges its child elements in a row.
Imagine packing items into a flexible shipping tube where they naturally line up in order and adjust their spacing automatically.
Flexbox is essential for modern web design because it eliminates complicated workarounds for centring items and distributing space evenly across navigation menus and cards.
- Activated by setting display flex on container
- Arranges items in a row by default
- Flex direction switches rows to columns
- Great for one-dimensional alignment tasks
- Centre content and distribute space between items using alignment properties.
Read more
Alignment properties in Flexbox give you precise control over how items are positioned along the main and cross axes of your container. You can pack items to the ends or centre them effortlessly.
Think of arranging cushions neatly along a sofa; you can space them evenly apart, push them all to the left, or float them right in the middle.
Mastering these alignment tools saves you hours of frustration, letting you build perfectly centred headers and balanced card grids with just a couple of lines of code.
- Justify content aligns along the main axis
- Align items aligns along the cross axis
- Space between pushes items apart evenly
- Centring items requires very little code
- (optional)
- Allow your flex items to wrap onto multiple lines when the screen gets too small.
Read more
Flex wrapping tells your flex items whether they are allowed to break onto new lines when the screen gets too narrow. By default, flex items try to squeeze onto a single line.
Imagine a row of books on a shelf; if you push the shelf walls inward, the books either squash together or start spilling onto the shelf below.
Using wrap properties ensures your product grids and photo galleries remain usable and neat on smaller mobile screens without clipping content.
- Default nowrap forces items onto one line
- Flex wrap allows multi-line layouts
- Prevents items from shrinking too small
- Helps maintain responsiveness on mobile
Step 5: Page Layouts with CSS Grid
- Create grid structures with defined rows and columns to layout whole web pages.
Read more
CSS Grid is a two-dimensional layout system built for the web, allowing you to design rows and columns simultaneously. You define your grid structure on a container and drop items into place.
Think of a spreadsheet or a printed newspaper layout with defined columns and rows that hold stories and photographs in neat compartments.
Grid is invaluable for structuring entire web page layouts because it lets you plan complex macro-structures like headers, sidebars, and footers with absolute clarity.
- Activated with display grid on container
- Defines rows and columns using track sizes
- Handles two-dimensional layouts with ease
- Replaces complex floats and table hacks
- Position specific elements across multiple rows and columns in your grid.
Read more
Grid placement properties let you explicitly position individual items across multiple rows and columns in your grid template. You can make an element span across two or three tracks easily.
Think of merging cells in a spreadsheet table so that a single title header stretches across three columns of data.
Knowing how to place items precisely allows you to build creative, asymmetrical layouts where featured articles or banners take up more visual space than standard cards.
- Grid column spans items across columns
- Grid row spans items across rows
- Uses line numbers to define start and end
- Creates featured hero content areas
- (optional)
- Let the browser automatically place items neatly into your grid tracks.
Read more
Auto placement is a clever feature where the browser automatically organises items into your grid tracks without you needing to explicitly code the position for every single element.
Think of an automatic sorting machine at a postal depot that slots incoming parcels into the next available shelf compartment.
This matters for dynamic content like blog feeds or product lists where items are added regularly, ensuring new additions always snap neatly into your grid structure.
- Browser places items into next free slot
- Auto flow controls row or column direction
- Saves time for repetitive item lists
- Adapts automatically to new content
Step 6: Responsive Design and Animation
- Apply different CSS rules depending on the screen size of the user's device.
Read more
Media queries are conditional CSS rules that apply specific styling blocks only when certain device criteria, such as screen width, are met. They form the bedrock of responsive web design.
Think of smart home lighting that automatically dims when the sun goes down and brightens in the morning.
Using media queries is essential for ensuring your website provides a comfortable, readable experience whether someone is viewing it on a tiny smartphone or a large widescreen monitor.
- Starts with the at-media rule syntax
- Checks device features like screen width
- Applies changes only when conditions match
- Essential for mobile-friendly web pages
- Use relative units like percentages, rems, and viewport widths to scale your designs.
Read more
Responsive units like percentages, rems, and viewport widths allow your designs to scale fluidly across screens instead of relying on fixed pixel measurements.
Think of wearing stretchy sportswear rather than tailored evening attire; it adjusts comfortably as you move.
Mastering relative units ensures your typography and layout spacing scale gracefully on any device, reducing the number of media queries you need to write.
- Rems scale relative to root font size
- Percentages scale to parent containers
- Viewport units match screen dimensions
- Creates fluidly resizing typography
- Create smooth visual changes when a user hovers over buttons or links.
Read more
Transitions let you animate property changes smoothly over a set duration instead of having them snap instantly when a user interacts with your page.
Think of a dimmer switch that fades a light bulb on gradually rather than flashing it on instantly.
Adding gentle transitions elevates the polish of your user interface, making buttons, navigation menus, and card hovers feel tactile, modern, and delightful to use.
- Transition property targets specific changes
- Duration sets how long the animation takes
- Easing functions control speed curves
- Triggers smoothly on hover or focus
- (optional)
- Store reusable values like colours and font sizes in variables to update your site quickly.
Read more
CSS variables allow you to store reusable values like brand colours and font sizes in custom properties, making it easy to update your entire site from one place.
Think of a master recipe ingredient list where changing the amount of sugar updates the flavour across every batch of cakes.
Using variables keeps your stylesheets organised, maintainable, and makes implementing dark mode themes or rebranding a breeze.
- Declared with a double dash prefix
- Stored usually in the root selector
- Accessed using the var function
- Allows instant site-wide theme updates