Basic Web Design Tutorial Part 3

A quick explanation of Entities (HTML encoding)

The clever ones among you might be asking “So if < and > mark tags then how do you put those symbols in a page?”. The answer is that certain symbols are encoded. Here are some common ones:
&lt; gives < (“lt” stands for less than)
&gt; gives > (“gt” stands for greater than)
&copy; will give a copyright mark (©)

And of course & is used to denote the start of an entity and so we have to use:
&amp; to give an ampersand (&)

Put these codes (such as “&lt;”)in your HTML file and they will appear as the symbol (such as “<”) when the page is displayed in a browser.

Mostly you don’t need entities but they can sometimes explain why your page gets displayed badly if you use certain symbols. I strongly recommend using an HTML validator to check your code as you work. I use Firefox and it’s HTMLValidator plugin (but don”t worry too much about that now).

Example 3 – an entity

Note: I’ve stripped this down as much as possible and left out the HEAD tag completely just to make it smaller and more readable.

And I love HTML &amp; the web.

Example 3

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Leave a Comment