Start the CSS Masterclass and see how to learn through written lessons, browser-based exercises, and module quizzes.
CSS controls how a browser presents HTML. A single button shows three parts of that process. A selector matches the button, the cascade resolves rules that compete to style it, and layout determines how much space it takes up next to other elements.
Start with the lessons below if you know basic HTML. Edit CSS in the lesson exercises and check your understanding with a quiz at the end of each module. You can read the opening lessons without an account. Sign in and enroll for free to open the full curriculum and save your progress.
Start by reading a CSS rule. Connect a stylesheet to HTML, then use the browser’s inspector to see which declarations apply.
Resolve competing rules and use custom properties to share colors and spacing.
Measure the box model. Predict how padding and borders affect a component’s width.
Arrange a row of controls with Flexbox, then use Grid when rows and columns need to align.
Adapt a layout to different screens, then work through forms, keyboard focus, motion preferences, and testing.
Try the primary button challenge whenever you want extra practice. Compare your result with the target and adjust one property at a time.
When you encounter an unfamiliar property, look up its syntax and accepted values in the MDN CSS reference.