Some characters are reserved for coding in HTML (ex:
"). If these characters are to be included in your text, it can’t be written like the rest of it. HTML Entities allow us to add the characters reserved for coding HTML into our text. To add an HTML Entity, you need to write a
& followed by the characters code.
For example, to add a less than sign (
<), you can write
lt is the Entity Name and
#60 is the Entity Number.
CAUTION: Entity names are case sensitive.
Similarly, there is an Entity to add extra space:
&npsp (non-breaking space) or
Look at the sentence below:
No matter how many physical spaces we add, HTML always renders it as a single space.
There are two ways to add an extra space :
<pre>. As the name implies, the text is displayed as it is coded.
<pre>tag displays text with a fixed-width font (usually Courier).
View all Courses