HTML Character Entities (HTML Tutorial part 14)

১১/১৮/২০১১ ০৮:২৩:০০ AM | | 0 comments »

An entity is a fancy term for a symbol. Several symbols such as copyright, trademark, or foreign cash symbols exist outside of the ones you see on your keyboard. In order to display them. In order to display these characters, you need to know 4 parts.

There's three parts to every entity.

HTML Code:

  • Each begins with a ampersand - &
  • Then the entities name - copy
  • And finally a semicolon - ;

Copyright:

Combine © to make - © - Copyright symbol.
Expect complications if you forget to include all three parts of an entity.

Additional Spaces and <>.

As you have may have learned within paragraph and heading tags, browsers will only recognize and format 1 space between words reguardless of how many you may actually type in your coded HTML. An entity exists for placing additional spaces.
Here's an example.

HTML Code:

<p>Everything that goes up, must come &nbsp;&nbsp;&nbsp;&nbsp;down!</p>

Spaces:

Everything that goes up, must come    down!
In HTML we use less than and greater than characters to create tags, so to use them on your web site you will need entities.

HTML Code:

<p>
Less than - &lt; <br />
Greater than - &gt; <br />
Body tag - &lt;body&gt;
</p>

Less than Greater than:

Less than - <
Greater than - >
Body tag - <body>
Take a few minutes to view and play with the symbols listed in the Entities Table.