HTML Entities
Character references represent characters that would otherwise be difficult or ambiguous to write in markup. They are especially important when displaying HTML source as text.
How it works
- Use < for a less-than sign and & for an ampersand when needed in HTML source. Named references end with a semicolon.
- Numeric references can be decimal or hexadecimal. They represent Unicode code points rather than image files.
- HTML escaping and URL encoding solve different problems. Encode for the context where the value will be interpreted.
A practical example
<p>Use <h1> for the page’s main heading.</p>
<p>Tools & materials</p>
<a href="search.html?topic=html&level=beginner">Beginner HTML topics</a>
The first paragraph displays literal tag spelling. The link’s HTML source escapes the query-string separator while the actual URL retains its ampersand.