Build layouts that work on every screen: flexbox, grid, media queries, positioning, smarter selectors and smooth transitions.
- 28 lessons
- 7 units
- 4 h 12 m in all
- £0, for good
what’s inside.
For people who finished Level 1, or can already write small programs with variables, decisions, loops and functions.
CSS Level 2 picks up where Level 1 ends. In 28 lessons you master flexbox and grid, make pages fit any screen, pin boxes in place, target elements by position and state, and polish everything with transitions and fitted pictures. It ends with a level check: a responsive recipe board you build yourself.
every lesson goes the same way.
- meet it
- guess first
- your turn
- fix it
- nailed it
unit 1
Flex in depth
Make rows and columns that bend to fit the space they get.
- Rows or columns8 minTurn a flex row into a column and know which way is which.
- Wrapping onto new lines8 minLet a full row of boxes spill onto a new line.
- Sharing out spare room8 minLet flex children grow to fill the empty space in a row.
- Starting size and squeezing10 minSet where each child starts, stop it squashing, and use the
flexshorthand.
unit 2
Line it up
Place each flex child exactly where you want it, on any screen.
- More ways to spread out8 minPush flex children to the far end or spread them evenly.
- Stretch on the cross axis8 minSee why flex children stretch, and stop them when you need to.
- One child its own way9 minMove a single flex child with
align-selfor anautomargin. - Cards that wrap and fill10 minBuild a row of cards that rearranges itself on any screen.
unit 3
Grids
Lay boxes out in rows and columns at the same time.
unit 4
Fit any screen
Make one page look right on a small phone and on a wide screen.
- Media queries10 minChange the layout once the screen is wide enough.
- Units that follow the screen9 minSize things by the screen with
vwandvh, or by the text withem. - Sizes with limits10 minLet sizes stretch with the screen, but never too far.
- Grids that fit themselves10 minLet a grid choose its own number of columns, with no media query.
unit 5
Position anything
Lift boxes out of the flow and pin them exactly in place.
- Nudging with relative8 minShift a box from its normal spot without moving anything else.
- Absolute inside a parent10 minPin a badge to the corner of a card.
- Sticky headers8 minKeep a header in view while the page scrolls under it.
- Fixed and on top9 minPin a button to the screen and choose what sits in front.
unit 6
Smarter selectors
Target exactly the elements you mean, wherever they sit and whatever state they are in.
- Inside and directly inside9 minStyle elements by where they sit, using a space or
>. - Counting children9 minStyle the first, the last or every other child, with no extra classes.
- Showing where the keyboard is9 minGive keyboard users a clear focus ring with
:focus-visible. - Decorations with ::before and ::after9 minAdd little extras to the page with CSS alone.
unit 7
Finishing touches
Smooth changes, neat pictures and a full layout for every screen.
- Smooth changes8 minFade between two looks instead of snapping from one to the other.
- Speed curves and waiting9 minChoose how a transition speeds up, and when it starts.
- Pictures that fit8 minFill a frame with any picture without squashing it.
- Putting it all together12 minBuild a responsive card layout from everything in this level.