CSS Basics

CSS is the language that controls how a web page looks. In these lessons you style real pages and see every change the moment you type it: colors, fonts, spacing, side-by-side layouts and designs that adapt to small screens.

0 of 11 lessons done
Start Course

Part 1Styling Basics

  1. Your First Style RuleWrite your first CSS rule and learn the three parts every rule has: selector, property and value.
  2. Classes and IDsStyle just the elements you choose by giving them a class or an id and selecting it in CSS.
  3. Fonts and TextChange typefaces, sizes, weight, alignment and line spacing to make text easy to read.
  4. Colors and BackgroundsWrite exact colors with hex codes and rgb(), and set background colors with good contrast.

Part 2Boxes and Layout

  1. The Box ModelUnderstand padding, border and margin: the three layers of space around every element.
  2. Width and CenteringControl how wide a box is with width and max-width, and center it on the page with auto margins.
  3. Flexbox: Side by SidePlace elements in a row with display flex, space them with gap and spread them out with justify-content.
  4. Flexbox: Alignment and WrappingCenter items vertically with align-items, let rows wrap onto new lines and make items grow to fill space.

Part 3Finishing Touches

  1. Hover Effects and TransitionsChange how an element looks when the mouse is over it, and animate the change smoothly.
  2. Responsive DesignUse media queries so one page looks right on phones, tablets and wide screens.
  3. Project: A Profile CardCombine everything from the course to style a centered, rounded profile card with a hover effect.

Your Certificate

Finish every lesson in this course to unlock a certificate with your name on it.

What you will learn

HTML says what is on a page. CSS says how it looks. This course takes you from your first style rule to a finished, responsive card layout.

Before you start

You should know basic HTML: tags, attributes and how elements nest. If that is new, take HTML Basics first. It takes about two hours.

How the lessons work

Each lesson gives you a small page with its HTML already written. You write the CSS in the style.css tab and the preview updates as you type. The checks look at how the page really renders, so there is often more than one correct way to write the answer.

Frequently asked questions

Do I need to know HTML first?

Yes, a little. You should be comfortable with tags, attributes and nesting. The HTML Basics course on this site covers everything you need.

Is this CSS course free?

Yes. Every lesson is free, with no account and no limits.

Does the course cover flexbox?

Yes. Two lessons cover placing items in a row, spacing them out, aligning them and letting them wrap, and the final project uses flexbox for a card layout.

How are my answers checked?

The checks measure the page in the preview: the real color, size or position of an element. That means you can use any valid CSS that produces the right result.

Do I get a certificate?

Yes. Finish every lesson to unlock a certificate of completion with your name on it. It is a personal record, not an accredited qualification.