Using escape characters in HTML

first published: 15/03/2023

The page you're reading right now is an HTML document, made up of various tags. So how does the browser know whether something is supposed to be an HTML tag that is not visible to the user, or text that is visible to the user?

This is done through the use of reserved characters in HTML. the "<" and ">" are reserved characters in HTML used for opening and closing HTML tags. You should always use escape characters for any reserved characters in HTML to ensure they render correctly.

Escape characters are used to tell the browser that you're writing a tag, which is how I can write this:

<p>This is a paragraph</p>

If I didn't use the escape characters, the browser would think I was writing a paragraph tag, and it would render it as such.