Anchor Positioning — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the Anchor Positioning lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Create the anchor context
easy10 minMake #wrap the positioning context.
- 2
Pin to the bottom-right
easy10 minPlace #box at the bottom right of its context.
- 3
Offset from an edge
easy10 minPlace #box 16px from the top and 24px from the left.
- 4
Stretch across the context
easy10 minUse inset 0 so #box fills its positioned parent.
- 5
Raise the anchored element
medium10 minPin it and lift it above siblings with z-index.
Find the bug(5)
- 1
Fix the missing context
easy8 minWithout a positioned parent the box anchors to the page.
- 2
Fix the wrong edges
easy8 minThe box should sit bottom-right, not top-left.
- 3
Fix the z-index without position
easy8 minz-index is ignored on a static element.
- 4
Fix inset written as a single edge
easy8 mininset sets all four edges at once.
- 5
Fix the swapped offsets
easy8 minThe top and left values are the wrong way round.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace