Menu
HTML Fundamentals

Entities & Whitespace

Escape special characters with &, <, >,  .

1Character Entities

Some characters are reserved in HTML. Use entities so the browser shows them literally instead of treating them as markup.

Example Code
css
<p>5 &lt; 10 &amp;&amp; 20 &gt; 5</p>
<p>Use &nbsp; for non-breaking spaces.</p>
<p>&copy; 2026 &mdash; All rights reserved.</p>

2Put the element in context

Normal HTML text usually collapses runs of whitespace during rendering. Entities represent characters that would otherwise conflict with markup or are inconvenient to type. Use them for the intended character, rather than as a repeated substitute for layout spacing.

3Practice with a small page

Write a sentence with several spaces and compare its source with the rendered result. Display literal angle brackets through entities. Use CSS for the distance between two controls instead of inserting a long series of non-breaking spaces.

Finished reading?

Mark this topic as complete to track progress.