Important distinction: Character references help represent characters in HTML syntax. They are not a substitute for context-aware output encoding, HTML sanitization, or server-side validation.
15. Practical Exercises
Exercise 1: Write Useful Comments
Create a page with a heading, introduction, and footer. Add one meaningful HTML comment before each major section. Confirm that the comments do not appear as ordinary visible text.
Exercise 2: Display Reserved Characters
Create paragraphs that display the following text correctly:
- 5 is less than 10.
- 10 is greater than 5.
- HTML & CSS.
- Copyright © 2026 Codementrix.
Use appropriate named character references where helpful.
Exercise 3: Display HTML as Code
Write a code example that displays the following markup as text rather than interpreting it as an actual heading:
<h1>Learn HTML</h1>Place the example inside pre and code elements and escape the markup characters in the surrounding source.
Exercise 4: Use Numeric Character References
Display ©, €, ✓, and 😀 using both decimal and hexadecimal numeric character references.
Exercise 5: Build a Multilingual Page
Create a complete HTML document with UTF-8 encoding. Include English, Odia, Hindi, a currency symbol, and an emoji. Use language attributes where appropriate and test the page in a browser.
Exercise 6: Investigate Encoding
Open a text editor and verify that your HTML file is saved as UTF-8. Inspect the document in your browser and check that all characters render correctly. If a character appears incorrectly, investigate the source encoding and font support before changing the text.
16. Quiz: Comments, Entities, Unicode and Special Characters
Test your knowledge with these 10 questions. Each question has four plausible options, the correct answer, and an explanation for every option.
Suggested passing score: 8 out of 10. Choose your answer before expanding the explanation. These expandable answers do not automatically calculate a score or save learner progress unless additional quiz functionality is implemented.