CSS Pseudo Elements — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Pseudo Elements 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
Add content before
easy10 minAdd a ::before marker to .text and colour the paragraph red.
- 2
Give the pseudo-element a colour
easy10 minColour .text green so its ::before inherits it.
- 3
Add content after
easy10 minAppend a marker after .text and colour the element blue.
- 4
Use an empty content value
easy10 minCreate a decorative box with empty content and a red parent.
- 5
Style the first line
medium10 minUse ::first-line and colour the paragraph green.
Find the bug(5)
- 1
Fix the missing content
easy8 minWithout content the pseudo-element never renders — colour the element green.
- 2
Fix the misspelled pseudo-element
easy8 minIt is ::before, not ::bofore — and the paragraph should be blue.
- 3
Fix the wrong element targeted
easy8 minThe rule styles the span but the paragraph was intended.
- 4
Fix after used instead of before
easy8 minThe marker should trail the text and the element must be blue.
- 5
Fix the unquoted content
easy8 minA content string must be quoted.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace