Web Design & Development

[ Web Design & Development Topics ]

Entities

Some characters have a special meaning in HTML, like the less than sign (<) that defines the start of an HTML tag. If we want the browser to actually display these characters we must insert character entities in the HTML source.

Entities are special characters that have a distinct meaning to HTML,so that when you want to actually use the character on your page you need to write some special code:

Result Description Entity Name Entity Number
  non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
" quotation mark &quot; &#34;
' apostrophe  &apos; (does not work in IE) &#39;

Some Other Commonly Used Character Entities:

Result Description Entity Name Entity Number
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
§ section &sect; &#167;
© copyright &copy; &#169;
® registered trademark &reg; &#174;
× multiplication &times; &#215;
÷ division &divide; &#247;

See http://www.w3schools.com/html/html_entities.asp

So if I wanted to write the line:

15¢ ÷ 3 = 5¢    (simple division)

The code would look like:

<p>15&cent; &divide; 3 = 5&cent;&nbsp;&nbsp;&nbsp;&nbsp;(simple division)</p>