Section A.2. HTML Character Entities


A.2. HTML Character Entities

HTML character entities are codes you can enter in a page that are then translated into other characters by the browser before they're displayed. All HTML character entities start with the ampersand (&) and end with the semicolon (;).

There are two reasons you might want to use HTML character entities. First of all, you might want to use a character that is considered to have a special meaning in the HTML standard. For example, if you type < in an HTML document, the browser assumes you're starting a tag, which makes it difficult to write a pithy bit of logic like "2 < 3." To get around this, you can replace the < symbol with a character entity that represents the less-than symbol. The browser will then insert what you want when it displays the page.

The other reason you might use HTML character entities is because you want to use a special character that's not easy to type, like an accented letter or a currency symbol. In fact, it's quite possibly not on your keyboard at all.

Table A-2 has the most commonly used HTML entities. For the complete list, which includes many more international language characters, see http://webmonkey.wired.com/webmonkey/reference/special_characters.

Table A-3. HTML Character Entities

Character

Name of Character

What to Type

<

Less than

&lt;

>

Greater than

&gt;

&

Ampersand

&amp;

"

Quotation mark

&quot;

Copyright

&copy;

Registered trademark

&reg;

Cent sign

&cent;

& pound ;

Pound sterling

&pound;

Yen sign

&yen;

Euro sign

&euro; (but &#8364; is better supported)

°

Degree sign

&deg;

±

Plus or minus

&plusmn;

·

Division sign

&divide;

x

Multiply sign

&times;

µ

Micro sign

&micro;

¼

Fraction one-fourth

&frac14;

½

Fraction one-half

&frac12;

¾

Fraction three-fourths

&frac34;

Paragraph sign

&para;

§

Section sign

&sect;

«

Left angle quote, guillemotleft

&laquo;

»

Right angle quote, guillemotright

&raquo;

Inverted exclamation

&iexcl;

Inverted question mark

&iquest;

Small ae diphthong (ligature)

&aelig;

§

Small c, cedilla

&ccedil;

Small e, grave accent

&egrave;

Small e, acute accent

&eacute;

Small e, circumflex accent

&ecirc;

«

Small e, dieresis or umlaut mark

&euml;

Small o, dieresis or umlaut mark

&ouml;

Capital E, acute accent

&Eacute;




Creating Web Sites. The Missing Manual
Creating Web Sites: The Missing Manual
ISBN: B0057DA53M
EAN: N/A
Year: 2003
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net