HTML Character Entities
Some characters like the < character, have a special meaning in HTML, and therefore cannot be used in the text.
To display a less than sign (<) in HTML, we have to use a character entity.
_____________________________________________________________________________
Character 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. A character entity has three parts: an ampersand (&), an entity name or a # and an entity number, and finally a semicolon (;). To display a less than sign in an HTML document we must write: < or < >
_____________________________________________________________________________
Non-breaking Space
The most common character entity in HTML is the non-breaking space.
Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the character entity.
_____________________________________________________________________________
The Most Common Character Entities:
Result | Description | Entity Name | Entity Number |
---|---|---|---|
non-breaking space | |   | |
< | less than | < | < |
> | greater than | > | > |
& | ampersand | & | & |
" | quotation mark | " | " |
' | apostrophe | ' (does not work in IE) | ' |
Some Other Commonly Used Character Entities:
Result | Description | Entity Name | Entity Number |
---|---|---|---|
¢ | cent | ¢ | ¢ |
£ | pound | £ | £ |
¥ | yen | ¥ | ¥ |
€ | euro | € | € |
§ | section | § | § |
© | copyright | © | © |
® | registered trademark | ® | ® |
× | multiplication | × | × |
÷ | division | ÷ | ÷ |
HTML Links
HTML uses a hyperlink to link to another document on the Web.
_____________________________________________________________________
The Anchor Tag and the Href Attribute
HTML uses the <a> (anchor) tag to create a link to another document.
An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc.
The syntax of creating an anchor:
<a href="url">Text to be displayed</a> |
The <a> tag is used to create
an anchor to link from, the href attribute is used to address the document
to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink.
This anchor defines a link to Knowledgerush:
<a href="http://http://knowledgerush.blogspot.com/">Visit Knowledgerush!</a> |
The Target Attribute
With the target attribute, you can define where the linked document will be opened.
The line below will open the document in a new browser window:
<a href="http://knowledgerush.blogspot.com/" target="_blank">Visit knowledgerush !</a> |
__________________________________________________________________________________
The Anchor Tag and the Name Attribute
The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for.
Below is the syntax of a named anchor:
<a name="label">Text to be displayed</a> |
The name attribute is used to create a named anchor. The name of the anchor
can be any text you care to use.
The line below defines a named anchor:
<a name="tips">Useful Tips Section</a> |
You should notice that a named anchor is not displayed in a special way.
To link directly to the "tips" section, add a # sign and the name of the anchor to the end of
a
URL, like this:
<a href="http://knowledgerush.blogspot.com/html_links.asp#tips"> Jump to the Useful Tips Section</a> |
A hyperlink to the Useful Tips Section from WITHIN the file "html_links.asp"
will look like this:
<a href="#tips"> Jump to the Useful Tips Section</a> |
Regards:-
Manan Saini.
No comments:
Post a Comment