Useful HTML Entities

Some characters have special meanings in HTML. For example if you try to use the less than (<) or greater than (>) symbols in your text, the browser can easily get confused and the results can be very different from intended. Your can display these special characters by using HTML Entities.

In the HTML code you indicate HTML Entities by using an ampersand &, a character name and a semi colon. For example to put a © symbol you would use &copy; or the Entity Number with a hash # &#169;. Some browsers don’t display all the HTML Entities by character name, so it is preferable to use numbers if you can as this has wider browser support.

You cannot use HTML Entities as part of a URL – as the ampersand &, % and hash # have specific meanings within a web address you cannot use HTML Entities in a URL. An ampersand is used to supply information to a page via a URL eg: www.ersws.com&id=123 and a hash is used for putting a bookmark to a specific part of a page eg: www.ersws.com/stuff/#coolbeans. A % is used to indicate symbols eg: %20 is a space.

You can use HTML Entities when writing a blog post, widget or page in WordPress.

If you use < or > in your page text for something other than HTML Code than your page WILL NOT pass w3c Validation. You should use the HTML Entites eg: &lt; or &gt;.

You can use HTML Entities to display HTML code on a page rather than run the code (or Javascript, PHP etc) by replacing the < > in the tags with HTML Entities. Eg: &#60;p&#62;Hello World&#60;/p&#62;.

For a full list of every HTML Entity see http://www.w3schools.com/tags/ref_entities.asp

Symbol Notes Name Number
  non-breaking space &nbsp; &#160;
© copyright &copy; &#169;
® registered trademark &reg; &#174;
trademark &trade; &#8482;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
¡ upside down exclamation mark &iexcl; &#161;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
euro &euro; &#8364;
° degree &deg; &#176;
± plus-or-minus  &plusmn; &#177;
¼ fraction 1/4 &frac14; &#188;
½ fraction 1/2 &frac12; &#189;
¾ fraction 3/4 &frac34; &#190;
¹ superscript 1 &sup1; &#185;
² superscript 2 &sup2; &#178;
³ superscript 3 &sup3; &#178;
bullet &bull; &#8226;
left arrow &larr; &#8592;
up arrow &uarr; &#8593;
right arrow &rarr; &#8594;
down arrow &darr; &#8595;
left right arrow &harr; &#8596;
carriage return arrow &crarr; &#8629;
# hash    — &#8629;

Comments

No spammy comments. All comments must be in English. All comments are moderated.

    Leave a Reply

    Your email address will not be published. Required fields are marked *