Skip to content

CSS Tutorial

CSS Tutorial: Learn CSS Step by Step

182 lessons 4 min read By Deepak Paswan Updated Oct 4, 2026

HTML gives a page its structure. CSS is what makes that structure look good. With CSS you change colors, spacing, fonts, sizes, layouts and much more, and you do it with short rules that you can read like sentences.

This course starts with your first rule and ends with small, complete projects. Each lesson is short, explains one idea with a small example, shows what you should see in the browser, and mentions the mistakes people usually make.

What you will learn

What you need to know first

You should be comfortable with basic HTML: what an element and an attribute are, and how headings, paragraphs, lists, links and div elements look in the code. If not, work through the HTML course first, or keep it open alongside this one. You do not need any programming experience.

How to use this course

  • Go in order. Later lessons use earlier ones. Use the chapter list on the left (or the course button on a phone) to move around.
  • Press Try it. Most examples have a Try it button. It opens the code in an editor beside a live result. Change a value, press Run and watch what happens. That is the fastest way to learn what each property does.
  • Narrow the result. For responsive lessons, drag the bottom-right corner of the Result panel to make it narrower and see media queries react.
  • Do the exercises. Exercises, challenges and debugging tasks are marked in the chapter list. Try them before opening the solution.
  • Use the browser tools. Developer tools let you see and change the CSS of any page, and they are the best debugging tool you have.
  • Come back as a reference. When you forget a property, the quick reference points you to the lesson that explains it.
lightbulb
Start here
New to CSS? Begin with What Is CSS?. Already know the basics? Skim the chapter list and jump to the chapter you need.

Frequently Asked Questions

CSS Frequently Asked Questions

The basics are not. You can style a page after your first lesson. What takes practice is layout, and knowing why one rule wins over another. Both get easier when you build small things and look at them in the browser developer tools.
Yes, a little. CSS styles HTML elements, so you need to know what a heading, a paragraph, a list, a link and a div are. If you are new to HTML, take the HTML course first or alongside this one.
Flexbox first. It is simpler and covers rows and columns of items, like navigation bars and card rows. Grid is for layouts with rows and columns together. This course teaches them in that order.
In a separate .css file linked from your HTML. The lessons use a style element so you can see HTML and CSS side by side, but real sites use external stylesheets. The Getting Started chapter explains all three ways.
No. A web browser and a plain text editor are enough, and every example in the course runs in the Try it editor on the page.

Course contents

Getting Started

What CSS is, how a rule is written and the three ways to add CSS to a page.

CSS Colors

Every way to write a color in CSS, and how to pick colors people can read.

CSS Backgrounds

Background colors, images, repeating, positioning and sizing.

CSS Borders

Borders, rounded corners and outlines.

The CSS Box Model

Content, padding, border and margin: how every element gets its size and spacing.

CSS Text

Alignment, decoration, spacing, shadows and how text wraps.

CSS Fonts

Font families, sizes, weights and loading your own or Google fonts.

CSS Links

Link states, hover effects and links that look like buttons.

CSS Lists

Bullet types, custom markers and counters.

CSS Tables

Borders, spacing, stripes, hover effects and tables on small screens.

CSS Display

Block, inline, inline-block and the three ways to hide an element.

CSS Position

Placing elements exactly, from relative nudges to sticky headers.

CSS Overflow

What happens when content is bigger than its box.

CSS Units

px, %, em, rem, vw, vh and fr: what each one measures and when to use it.

CSS Pseudo-elements

Style parts of an element or add decoration without extra HTML.

CSS Forms

Inputs, buttons, focus and validation states, styled so they stay usable.

CSS Transitions

Smooth changes from one style to another.

CSS Transforms

Move, rotate, scale and skew elements without disturbing the layout.

Shadows and Effects

Box shadows, filters and gradients.

CSS Variables

Store values once and reuse them: colors, spacing, themes and dark mode.

CSS Functions

calc(), min(), max(), clamp() and var() for values that adapt.

CSS Specificity and the Cascade

Why one rule wins over another, and how to stop fighting your own CSS.

CSS Inheritance

Which values pass from parent to child, and how to control that.

CSS Best Practices

Naming, organizing and structuring CSS so it stays easy to change.

Practical Projects

Seven small builds that put the course together.

CSS Practice

Exercises, layout challenges, debugging tasks and a quick reference.