When someone clicks on a link on your site, the browser generally takes that person to the top of the new document. But if you want to link to a specific section of that webpage, then you have to make use of name or id attribute.
The process of creating a link to a specific section of another web page has two steps:
Step 1: Creating a named anchor.
Step 2: Linking to the named anchor.
A named anchor looks like a hyperlink where the HTML code is concerned but does not function as a link. This anchor has a name only. The text included in the tag is not underlined or displayed in blue like other standard links. You will not be able to click it. It works as an invisible marker in the document to which the link will lead. It has the normal style of a block of text and note the appearence of a hyperlink.
Syntax:
<A Name="anchor">marker</A>
Example:
<A Name="Manali">Manali</A>
To create a link pointing to the location of a named anchor, you need to insert a "#" symbol before the nameof the anchor to which you are linking. The name given here must match with the name of the anchor in the other document; otherwise, the browser will not recognise which part of the file to link.
Syntax:
<A Href="document1.html#named_anchor"> hypertext</A>(To be given in document2)
Example:
<A Href="inputdevice.html"#Keyboard">
Keyboard</A>
Type the following HTML code in notepad and save the file with the name 'link.html'.
|
<HTML> <HEAD> <TITLE>USING LINKS IN OTHER DOCUMENT </TITLE> </HEAD> <BODY Bgcolor="Lightyellow"> <UL> <H1>Different Input Devices Are: </H1> <FONT Face="Monospace corsiva" Size=6> <LI> <A Href="linking.html#Keyboard">Keyboard</A> <LI> <A Href="linking.html#Scanning System">Scanning System</A> <LI> <A Href="linking.html#OCR">OCR</A> <LI> <A Href="linking.html#OMR">OMR</A> </FONT> </UL> </BODY> </HTML> |
learning computers withKips