Text Wrapping — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the Text Wrapping 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
Stop the text wrapping
easy10 minKeep #text on a single line.
- 2
Break long words
easy10 minLet long words in #text break rather than overflow.
- 3
Preserve whitespace
easy10 minKeep the whitespace in #text but still wrap lines.
- 4
Balance the heading
easy10 minEven out the line lengths of #title.
- 5
Truncate with an ellipsis
medium10 minOne line, hidden overflow, and a trailing ellipsis.
Find the bug(5)
- 1
Fix the hyphenated value
easy8 minThe value is nowrap, written as one word.
- 2
Fix the wrong break value
easy8 minThis should break only when a word would overflow.
- 3
Fix pre used where pre-wrap was meant
easy8 minWhitespace should be kept, but lines should still wrap.
- 4
Fix the wrap value
easy8 minEvening out line lengths uses balance, not pretty.
- 5
Fix the ellipsis that never shows
easy8 mintext-overflow needs hidden overflow and no wrapping.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace