Home / Courses / CSS Mastery: From Beginner to Advanced …
Frontend & UI

CSS Mastery: From Beginner to Advanced Responsive Design

A complete CSS learning path covering selectors, the cascade, layout, Flexbox, Grid, responsive design, custom properties, animation, accessibility, debugging and production-ready UI projects.

  • Bigyan Ghimire
  • Beginner
  • 30+ hours
  • 11 modules
  • 57 views

This course progresses from CSS fundamentals to modern layout systems and maintainable interface design. Each lesson includes a concept explanation, a practical stylesheet example, expected visual behaviour and a focused exercise.

You will build reusable components, responsive layouts and a complete landing page while learning how to debug CSS, respect accessibility preferences and keep styles organized as a project grows.

What You'll Learn

  • Understand the cascade, specificity and inheritance
  • Style typography, color, spacing and components consistently
  • Master box model, positioning, Flexbox and CSS Grid
  • Build responsive layouts with modern CSS
  • Create transitions, animations and accessible states
  • Organize maintainable styles and ship polished projects

Requirements

  • Basic HTML knowledge
  • A modern browser and code editor
  • No previous CSS experience required
Module 01 of 11

CSS Foundations and Setup

Connect a stylesheet and understand how browser styling works.

Connect a stylesheet and understand how browser styling works.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 1.1 · Module 01

What CSS Does

Learn the role of CSS and how style rules are applied.

What you will learn

  • Learn the role of CSS and how style rules are applied.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

A CSS rule contains a selector and declaration block. Each declaration combines a property and value. Browsers combine author styles with user-agent styles and other applicable rules.

Code example

p { color: #1f2937; font-size: 1rem; }

Expected result

Style a paragraph and inspect the computed styles.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 1.2 · Module 01

Inline, Internal and External CSS

Compare stylesheet placement and use an external file for maintainability.

What you will learn

  • Compare stylesheet placement and use an external file for maintainability.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

External stylesheets can be reused and cached. Keep presentation separate from content where practical and link the stylesheet from head.

Code example

<link rel="stylesheet" href="css/styles.css">

Expected result

Move three inline styles into styles.css.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 1.3 · Module 01

CSS Syntax, Comments and Values

Learn declarations, units, colors, functions and comments.

What you will learn

  • Learn declarations, units, colors, functions and comments.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

CSS values include keywords, lengths, percentages, colors and functions such as calc() and clamp(). Invalid declarations are generally ignored.

Code example

/* Main page text */\nbody { color: #222; margin: 0; }

Expected result

Try px, rem, %, rgb() and hex values.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 1.4 · Module 01

Browser DevTools and CSS Debugging

Inspect computed values and identify overridden declarations.

What you will learn

  • Inspect computed values and identify overridden declarations.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Use the Styles and Computed panels to see which declarations apply, which are overridden and which fail to parse. Test one change at a time.

Code example

.card { padding: 1rem; }\n.card { padding: 1.5rem; }

Expected result

Explain why the second padding declaration wins.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 02 of 11

Selectors, Cascade and Specificity

Target elements predictably without fragile selector chains.

Target elements predictably without fragile selector chains.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 2.1 · Module 02

Element, Class, ID and Group Selectors

Select elements using type, class, ID and comma-separated groups.

What you will learn

  • Select elements using type, class, ID and comma-separated groups.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Classes are reusable and usually preferable for styling. IDs should be unique within a document. Group selectors apply the same declarations to multiple targets.

Code example

h1, h2 { font-family: system-ui, sans-serif; }\n.card { border-radius: 12px; }

Expected result

Style headings and reusable cards.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 2.2 · Module 02

Combinators and Attribute Selectors

Use descendant, child, sibling and attribute selectors appropriately.

What you will learn

  • Use descendant, child, sibling and attribute selectors appropriately.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Combinators express relationships in the DOM. Attribute selectors can target elements based on attribute presence or value.

Code example

nav a { text-decoration: none; }\nform input[type="email"] { width: 100%; }

Expected result

Style nested navigation and email inputs.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 2.3 · Module 02

Pseudo-classes and Pseudo-elements

Use hover, focus, checked, first-child, before and after.

What you will learn

  • Use hover, focus, checked, first-child, before and after.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Pseudo-classes select elements in a state or position. Pseudo-elements style generated or specific parts of elements. Keep essential content in the document rather than relying on generated content.

Code example

a:hover { text-decoration: underline; }\nbutton:focus-visible { outline: 3px solid #2563eb; }\n.badge::before { content: "• "; }

Expected result

Add clear hover and keyboard-focus states.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 2.4 · Module 02

Cascade Layers, Specificity and Inheritance

Resolve conflicts with source order, specificity, importance and layers.

What you will learn

  • Resolve conflicts with source order, specificity, importance and layers.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

The cascade considers origin, importance, layers, specificity and order. Prefer simple class-based rules over escalating specificity or repeated !important declarations.

Code example

@layer reset, components, utilities;\n@layer components { .button { padding: .75rem 1rem; } }

Expected result

Refactor conflicting rules into clear layers.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 03 of 11

Colors, Typography and Visual Design

Create readable, consistent interfaces with deliberate visual hierarchy.

Create readable, consistent interfaces with deliberate visual hierarchy.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 3.1 · Module 03

Color Formats and Contrast

Use named colors, hex, RGB, HSL and custom properties.

What you will learn

  • Use named colors, hex, RGB, HSL and custom properties.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Contrast affects readability. Do not communicate meaning through color alone; combine color with text, icons or patterns where appropriate.

Code example

:root { --color-primary: #1d4ed8; --color-text: #172033; }\nbody { color: var(--color-text); }

Expected result

Choose text and background colors and check contrast.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 3.2 · Module 03

Font Families, Size and Line Height

Build readable type scales with system and web fonts.

What you will learn

  • Build readable type scales with system and web fonts.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Use a sensible font stack and line height. rem-based sizing helps scale typography consistently; load external fonts thoughtfully to avoid performance penalties.

Code example

body { font-family: system-ui, sans-serif; line-height: 1.6; }\nh1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; }

Expected result

Create a heading, body and small-text type scale.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 3.3 · Module 03

Spacing, Borders, Shadows and Radius

Establish consistent spacing and component surfaces.

What you will learn

  • Establish consistent spacing and component surfaces.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

A spacing scale makes a site feel coherent. Shadows and borders should communicate hierarchy rather than decorate every element equally.

Code example

:root { --space-1: .5rem; --space-2: 1rem; --radius-card: .75rem; }\n.card { padding: var(--space-2); border: 1px solid #dbe2ea; border-radius: var(--radius-card); }

Expected result

Style a card using a small design-token system.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 3.4 · Module 03

CSS Custom Properties and Design Tokens

Define reusable values and override them by theme or component.

What you will learn

  • Define reusable values and override them by theme or component.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Custom properties participate in the cascade and can be updated at runtime. Name tokens by purpose rather than by a temporary visual value.

Code example

:root { --surface: #fff; --text: #172033; --accent: #1d4ed8; }\n.card { background: var(--surface); color: var(--text); }

Expected result

Create a small set of theme tokens.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 04 of 11

Box Model, Sizing and Overflow

Control element dimensions, spacing and content flow.

Control element dimensions, spacing and content flow.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 4.1 · Module 04

Content, Padding, Border and Margin

Understand the box model and box-sizing.

What you will learn

  • Understand the box model and box-sizing.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

With content-box, width applies to content; with border-box, it includes padding and border. A global border-box rule makes sizing more predictable.

Code example

*, *::before, *::after { box-sizing: border-box; }\n.card { width: 20rem; padding: 1rem; border: 1px solid; }

Expected result

Compare box sizing and measure the resulting box.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 4.2 · Module 04

Width, Min/Max Size and Intrinsic Sizing

Use min-width, max-width, min-content, max-content and fit-content.

What you will learn

  • Use min-width, max-width, min-content, max-content and fit-content.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Intrinsic sizing lets content influence layout. max-width is useful for readable content containers, while min-width: 0 can allow flex and grid children to shrink.

Code example

.container { width: min(100% - 2rem, 72rem); margin-inline: auto; }

Expected result

Create a centered responsive content container.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 4.3 · Module 04

Margin Collapse and Spacing Patterns

Understand vertical margin collapse and choose layout spacing tools.

What you will learn

  • Understand vertical margin collapse and choose layout spacing tools.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Adjacent block margins may collapse in specific conditions. Gap in Flexbox and Grid is often more predictable for spacing siblings.

Code example

.stack { display: flex; flex-direction: column; gap: 1rem; }

Expected result

Replace inconsistent sibling margins with gap.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 4.4 · Module 04

Overflow, Visibility and Display

Choose display, overflow, visibility and opacity carefully.

What you will learn

  • Choose display, overflow, visibility and opacity carefully.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

display controls layout participation; visibility hides an element while retaining its layout space; opacity changes transparency but does not remove keyboard focus. Overflow should be intentional.

Code example

.scroll-panel { max-height: 16rem; overflow: auto; }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

Expected result

Test scrolling content and hidden text behaviour.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 05 of 11

Positioning and Layering

Place elements with normal flow, positioning and stacking contexts.

Place elements with normal flow, positioning and stacking contexts.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 5.1 · Module 05

Normal Flow and Position Values

Understand static, relative, absolute, fixed and sticky positioning.

What you will learn

  • Understand static, relative, absolute, fixed and sticky positioning.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Absolute elements are positioned relative to a containing block. Sticky positioning depends on scroll containers and inset values. Avoid removing content from normal flow without a clear reason.

Code example

.card { position: relative; }\n.card__badge { position: absolute; top: .75rem; right: .75rem; }

Expected result

Place a badge inside a card.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 5.2 · Module 05

z-index and Stacking Contexts

Understand why z-index sometimes appears not to work.

What you will learn

  • Understand why z-index sometimes appears not to work.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Stacking contexts can be created by positioned elements with z-index and by several other properties. A large z-index cannot escape its parent stacking context.

Code example

.site-header { position: sticky; top: 0; z-index: 10; }

Expected result

Debug overlapping header and modal elements.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 5.3 · Module 05

Sticky Headers and Fixed Controls

Create sticky navigation and fixed utility controls responsibly.

What you will learn

  • Create sticky navigation and fixed utility controls responsibly.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Fixed controls can cover content, particularly on mobile. Account for safe areas and ensure the page remains usable at zoomed text sizes.

Code example

.site-header { position: sticky; top: 0; background: white; }\n.back-to-top { position: fixed; right: 1rem; bottom: 1rem; }

Expected result

Test a sticky header and a fixed button on a narrow screen.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 5.4 · Module 05

Float, Clear and Modern Alternatives

Recognize legacy float layouts and use modern layout tools for new work.

What you will learn

  • Recognize legacy float layouts and use modern layout tools for new work.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Float remains useful for wrapping text around images, but Flexbox and Grid are generally better for application layout.

Code example

.article-image { float: left; width: 12rem; margin: 0 1rem 1rem 0; }

Expected result

Wrap article text around an image and compare with Grid.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 06 of 11

Flexbox Layout Mastery

Arrange items along one dimension and manage flexible space.

Arrange items along one dimension and manage flexible space.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 6.1 · Module 06

Flex Container and Main/Cross Axes

Use display:flex, flex-direction, justify-content and align-items.

What you will learn

  • Use display:flex, flex-direction, justify-content and align-items.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Flexbox is designed for one-dimensional layout. The main axis follows flex-direction, while the cross axis is perpendicular to it.

Code example

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

Expected result

Build a responsive toolbar.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 6.2 · Module 06

flex-grow, flex-shrink and flex-basis

Understand how flex items divide available space.

What you will learn

  • Understand how flex items divide available space.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

The flex shorthand combines growth, shrinkage and basis. A sensible basis helps define starting sizes before free space is distributed.

Code example

.layout { display: flex; gap: 1rem; }\n.sidebar { flex: 0 0 16rem; }\n.content { flex: 1 1 auto; min-width: 0; }

Expected result

Build a sidebar and content layout.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 6.3 · Module 06

Wrapping, Gap and Alignment

Use flex-wrap, align-content, order and gap carefully.

What you will learn

  • Use flex-wrap, align-content, order and gap carefully.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Wrapping creates additional flex lines when space is insufficient. Avoid changing visual order in a way that conflicts with the DOM reading order.

Code example

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }

Expected result

Create a wrapping tag list.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 6.4 · Module 06

Responsive Navigation with Flexbox

Build navigation that adapts across available widths.

What you will learn

  • Build navigation that adapts across available widths.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Prefer natural wrapping or a deliberate mobile navigation pattern. If using a JavaScript toggle, ensure its state and accessible label are exposed.

Code example

.nav-links { display: flex; flex-wrap: wrap; gap: 1rem; }\n@media (max-width: 40rem) { .nav-links { gap: .5rem; } }

Expected result

Build a navigation row that remains usable on mobile.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 07 of 11

CSS Grid Layout Mastery

Create two-dimensional layouts for galleries, dashboards and page structures.

Create two-dimensional layouts for galleries, dashboards and page structures.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 7.1 · Module 07

Grid Tracks, Columns and Rows

Use grid-template-columns, rows, gap and fr units.

What you will learn

  • Use grid-template-columns, rows, gap and fr units.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Grid defines rows and columns simultaneously. Fractional units distribute available space after fixed and intrinsic sizing considerations.

Code example

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

Expected result

Create a three-column gallery.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 7.2 · Module 07

repeat, minmax and auto-fit

Build fluid grids that adapt without many breakpoints.

What you will learn

  • Build fluid grids that adapt without many breakpoints.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

minmax() sets track bounds, and auto-fit or auto-fill can repeat tracks based on available space. Test content that has long words or wide images.

Code example

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }

Expected result

Create a responsive card grid.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 7.3 · Module 07

Grid Areas and Item Placement

Name page regions and position items across tracks.

What you will learn

  • Name page regions and position items across tracks.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Named grid areas make complex layouts easier to understand. Keep the visual placement aligned with a logical reading order.

Code example

.page { display: grid; grid-template-areas: "header header" "sidebar main" "footer footer"; grid-template-columns: 16rem 1fr; }

Expected result

Build a dashboard shell using grid-template-areas.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 7.4 · Module 07

Flexbox or Grid: Choosing the Right Tool

Choose layout systems based on one-dimensional or two-dimensional needs.

What you will learn

  • Choose layout systems based on one-dimensional or two-dimensional needs.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Flexbox is often ideal for a row of controls or navigation. Grid is strong for aligned rows and columns. They can be nested together rather than treated as competitors.

Code example

.dashboard { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }\n.widget { grid-column: span 4; }

Expected result

Rebuild a card dashboard and justify the layout choice.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 08 of 11

Responsive Design and Modern CSS

Support different viewports, user preferences and content sizes.

Support different viewports, user preferences and content sizes.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 8.1 · Module 08

Mobile-First Media Queries

Write base styles for small screens and add enhancements at content-driven breakpoints.

What you will learn

  • Write base styles for small screens and add enhancements at content-driven breakpoints.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Breakpoints should be chosen where the content needs them, not solely to match particular device names. Test zoom and intermediate widths.

Code example

.card-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }\n@media (min-width: 48rem) { .card-grid { grid-template-columns: repeat(2, 1fr); } }

Expected result

Test at narrow, medium and wide widths.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 8.2 · Module 08

Fluid Type and Spacing with clamp

Use clamp, min, max and viewport units for fluid sizing.

What you will learn

  • Use clamp, min, max and viewport units for fluid sizing.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

clamp() sets a minimum, preferred value and maximum. Ensure text remains readable at high zoom and does not grow excessively on large screens.

Code example

h1 { font-size: clamp(2rem, 1.2rem + 3vw, 4rem); }

Expected result

Create a fluid heading and explain each bound.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 8.3 · Module 08

Container Queries and Responsive Components

Adapt components to their container rather than only the viewport.

What you will learn

  • Adapt components to their container rather than only the viewport.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Container queries let a component change when its containing area changes. Set an appropriate containment context and retain sensible fallback styles.

Code example

.card-shell { container-type: inline-size; }\n@container (min-width: 32rem) { .profile-card { display: grid; grid-template-columns: 8rem 1fr; } }

Expected result

Make a profile card adapt inside different page columns.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 8.4 · Module 08

Responsive Images, Reduced Motion and Preferences

Use media features for motion, contrast and theme preferences.

What you will learn

  • Use media features for motion, contrast and theme preferences.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Respect prefers-reduced-motion and test dark-mode or contrast preferences where your design supports them. CSS should enhance accessibility rather than override user needs.

Code example

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

Expected result

Add reduced-motion support to a sample page.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 09 of 11

Transitions, Transforms and Animation

Add feedback and motion without making interfaces harder to use.

Add feedback and motion without making interfaces harder to use.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 9.1 · Module 09

Transitions and Easing

Animate changes to selected properties with transition.

What you will learn

  • Animate changes to selected properties with transition.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Transition only properties that need feedback. Avoid animating layout-heavy properties when transforms or opacity can achieve the same effect more smoothly.

Code example

.button { transition: background-color .2s ease, transform .2s ease; }\n.button:hover { transform: translateY(-2px); }

Expected result

Add hover and focus feedback to buttons.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 9.2 · Module 09

2D Transforms and Transform Origin

Use translate, scale, rotate and transform-origin.

What you will learn

  • Use translate, scale, rotate and transform-origin.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Transforms change visual rendering without changing normal-flow space. Ensure transformed content does not overlap nearby content or become hard to interact with.

Code example

.icon { transform: rotate(10deg); transform-origin: center; }

Expected result

Create a small interactive card hover effect.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 9.3 · Module 09

Keyframes and Animation Properties

Define keyframe sequences and control duration, iteration and fill mode.

What you will learn

  • Define keyframe sequences and control duration, iteration and fill mode.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Use animation for meaningful, restrained effects. Avoid infinite movement that distracts users, and respect reduced-motion preferences.

Code example

@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }\n.panel { animation: fade-in .35s ease-out both; }

Expected result

Animate a content panel on entry.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 9.4 · Module 09

Motion Accessibility and Performance

Review animation duration, motion sensitivity and compositing.

What you will learn

  • Review animation duration, motion sensitivity and compositing.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Large animated shadows and layout changes can be expensive. Keep motion purposeful, brief and optional when it may cause discomfort.

Code example

@media (prefers-reduced-motion: reduce) { .panel { animation: none; transition: none; } }

Expected result

Audit a page and remove unnecessary motion.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 10 of 11

Maintainable CSS, Architecture and Quality

Organize CSS for long-term projects and troubleshoot real layouts.

Organize CSS for long-term projects and troubleshoot real layouts.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 10.1 · Module 10

BEM and Component Naming

Use clear class names that describe components and their parts.

What you will learn

  • Use clear class names that describe components and their parts.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

BEM is one naming convention, not a browser requirement. Consistent naming makes styles easier to locate and reduces accidental coupling.

Code example

.course-card {}\n.course-card__title {}\n.course-card--featured {}

Expected result

Refactor a set of inconsistent classes.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 10.2 · Module 10

Organizing Files and Managing CSS Growth

Split base, layout, component and utility styles logically.

What you will learn

  • Split base, layout, component and utility styles logically.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Keep the architecture appropriate to project size. Avoid excessive file fragmentation for a small site, but separate repeated component patterns as they grow.

Code example

styles/\n  base.css\n  layout.css\n  components.css\n  utilities.css

Expected result

Organize a growing stylesheet and document imports.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 10.3 · Module 10

Specificity Debugging and Browser Compatibility

Find layout bugs using computed styles and feature support checks.

What you will learn

  • Find layout bugs using computed styles and feature support checks.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Check whether a declaration is overridden, invalid or unsupported. Use progressive enhancement and test the browsers your audience uses.

Code example

@supports (display: grid) { .layout { display: grid; } }

Expected result

Debug three intentionally conflicting rules.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 10.4 · Module 10

Accessibility, Performance and Final CSS Audit

Check contrast, focus visibility, overflow, motion and responsive behaviour.

What you will learn

  • Check contrast, focus visibility, overflow, motion and responsive behaviour.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Quality includes usability, maintainability and performance. Validate at zoom, keyboard navigation and narrow widths before publishing.

Code example

:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; }\nimg { max-width: 100%; height: auto; }

Expected result

Complete a checklist and record improvements.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Module 11 of 11

Professional Projects and Portfolio Delivery

Apply CSS skills to real interface patterns and a complete final project.

Apply CSS skills to real interface patterns and a complete final project.

Work through each lesson in order. Run the examples in your own browser or editor, then complete the practice task before moving on.

In This Module

Lesson 11.1 · Module 11

Project 1: Responsive Profile and Portfolio Card

Build a reusable profile card with image, text, links and small-screen layout.

What you will learn

  • Build a reusable profile card with image, text, links and small-screen layout.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Start with semantic HTML and a clear visual hierarchy. Use Grid or Flexbox for layout and custom properties for consistent spacing and colors.

Code example

.profile { display: grid; grid-template-columns: 6rem 1fr; gap: 1rem; align-items: center; }\n.profile img { width: 6rem; aspect-ratio: 1; object-fit: cover; border-radius: 50%; }

Expected result

Finish a profile card that works at 320px and desktop widths.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 11.2 · Module 11

Project 2: Pricing Table and Feature Comparison

Design readable pricing cards with accessible action states.

What you will learn

  • Design readable pricing cards with accessible action states.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Clearly distinguish plan features and pricing. Do not rely on color alone to identify a recommended plan; include a text label when needed.

Code example

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.25rem; }

Expected result

Build three pricing cards and test long feature lists.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 11.3 · Module 11

Project 3: Responsive Dashboard UI

Create a sidebar, top navigation, stat cards and content grid.

What you will learn

  • Create a sidebar, top navigation, stat cards and content grid.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Use Grid for the main shell and component-level Flexbox for card controls. Test overflow, long labels and keyboard focus.

Code example

.dashboard { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; }\n@media (max-width: 48rem) { .dashboard { grid-template-columns: 1fr; } }

Expected result

Build a dashboard layout with responsive widgets.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Lesson 11.4 · Module 11

Final Project: Premium Responsive Landing Page

Combine typography, tokens, grid, interactions and accessibility into one polished page.

What you will learn

  • Combine typography, tokens, grid, interactions and accessibility into one polished page.
  • Recognize when and why to use this technique.
  • Apply it in a small practical task.

Explanation

Deliver a consistent design system, responsive hero, feature cards, testimonials, FAQ and footer. Test real content and avoid placeholder links before publishing.

Code example

:root { --brand: #1d4ed8; --text: #172033; --space: 1rem; }\n.container { width: min(100% - 2rem, 72rem); margin-inline: auto; }\n.hero { display: grid; gap: 2rem; align-items: center; }\n@media (min-width: 48rem) { .hero { grid-template-columns: 1.1fr .9fr; } }

Expected result

Publish the landing page and include screenshots plus a self-review.

Practice task

Recreate the example without copying it line by line. Change at least one value, test the result, and write a short note explaining what changed and why. Check your work in the browser or runtime and fix any errors before continuing.

Key takeaway

Understand the purpose of the feature, use meaningful names, keep the code readable, and test both the expected case and a realistic edge case.

Your Instructor

Bigyan Ghimire

Instructor

Bigyan Ghimire

Full-Stack Developer

Full-stack web developer from Kathmandu, Nepal, specialising in PHP, JavaScript and MySQL.