Wednesday, January 17, 2018

Common special characters used in html makeup languange

Some Special Characters
 There’s just one more text-related topic before we close this chapter out. Some common characters, such as the copyright symbol ©, are not part of the standard set of ASCII characters, which contains only letters, numbers, and a few basic symbols. Other characters, such as the less-than symbol (<),
are available, but if you put one in an HTML document, the browser will interpret it as the beginning of a tag.
 Characters such as these must be escaped in the source document. Escaping means that instead of typing in the character itself, you represent it by its numeric or named character reference. When the browser sees the character reference, it substitutes the proper character in that spot when the page is
displayed.
 There are two ways of referring to a specific character: by an assigned numeric value (numeric entity) or using a predefined abbreviated name for the character (called a named entity). All character references begin with an “&” and end with a “;”.
 Some examples will make this clear. I’d like to add a copyright symbol to my page. The typical Mac keyboard command, Option-G, which works in my word processing program, may not be understood properly by a browser or other software. Instead, I must use the named entity &copy; (or its numeric
equivalent, &#169;) where I want the symbol to appear .

<p>All content copyright &copy; 2012, Jennifer Robbins</p>
or:
<p>All content copyright &#169; 2012, Jennifer Robbins</p>

 HTML defines hundreds of named entities as part of the markup language, which is to say you can’t make up your own entity. Table 5-2 lists some commonly used character references. If you’d like to see them all, the complete list of character references has been assembled online by the nice folks at
the Web Standards Project at www.webstandards.org/learn/reference/charts/
entities/.

Character  |  Description | Name | Number
     ;-  [Character space (non breaking space)  | &nbsp  |  &#160;],
& :- [ Ampersand | &amp;  |  &#038;],
‘   :-  [Apostrophe  | &apos;  |  &#039;]
<  :- [ Less-than symbol (useful fordisplaying markup on a webpage) | &lt;  | &#060;]
>  :-  [Greater-than symbol (usefulfor displaying markup on aweb page) | &gt;  | &#062;]
©  :- [Copyright | &copy; | &#169;]
®  :- [ Registered trademark | &reg; | &#174;]
™ :- [Trademark | &trade; | &#8482;]
£   :- [Pound | &pound; | &#163;]
¥   :- [Yen | &yen;  | &#165;]
€   :- [Euro | &euro; | &#8364;]
–   :- [En-dash | &ndash; | &#8211;]
— :- [Em-dash | &mdash; | &#8212;]
‘   :- [Left curly single quote | &lsquo; | &#8216;]
’   :- [Right curly single quote | &rsquo; | &#8217;]
“   :- [Left curly double quote | &ldquo; | &#8220; ]
”   :- [Right curly double quote | &rdquo; | &#8221;]
•   :- [Bullet | &bull; | &#8226;]
...  :- [Horizontal ellipsis | &hellip; |&#8230;]

wrapping it up:
Non-breaking Spaces
One interesting character to know about is the non-breaking space (&nbsp;). Its purpose is to ensure that a line doesn’t break between two words. So, for instance, if I mark up my name like this: Jennifer&nbsp;Robbins I can be sure that my first and last names will always stay together on a line.

NOTE
In XHTML, every instance of an ampersand must be escaped so that it is not interpreted as the beginning of a character entity, even when it appears in the value of an attribute. For example:
<img src="sno.jpg" alt="Sifl
&amp; Olly Show" />

happy coding season

0 comments:

Post a Comment