CSS exercises with solutions

48 practice problems from the 16 lessons of the CSS: Style and Lay Out Web Pages course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

16 easy problems 16 medium problems 16 hard problems

What CSS is and how it reaches a page

3 problems · Read the lesson

Selectors: choosing what to style

3 problems · Read the lesson

The cascade, specificity and inheritance

3 problems · Read the lesson

Colours, units and values

3 problems · Read the lesson

The box model

3 problems · Read the lesson

Text and fonts

3 problems · Read the lesson

Backgrounds, borders and shadows

3 problems · Read the lesson

Display and normal flow

3 problems · Read the lesson

Flexbox: laying things out in a line

3 problems · Read the lesson

Grid: laying things out in two dimensions

3 problems · Read the lesson

Positioning and stacking

3 problems · Read the lesson

Pseudo-classes and pseudo-elements

3 problems · Read the lesson

Custom properties (CSS variables)

3 problems · Read the lesson

Responsive design basics

3 problems · Read the lesson

Transitions, transforms and animations

3 problems · Read the lesson

Keeping CSS maintainable

3 problems · Read the lesson