Linking Document in HTML:
Let's discuss the Linking documents in HTML.
A linking documents in HTML is a unidirectional pointer from a source document that contains a link to the same destination. Links help the user to navigate across pages as well as within a page.
The text or an image that provides such a link is called hypertext or hyperlink.
<a href="name of the file to link i.e bookmark" target="location"> title of the link</a>
A hyperlink can be created by using an <a> anchor tag, which stands for anchor and has the following attributes:
href: It stands for hypertext reference which points the link to the bookmark/file from your PC. it contains the name of the bookmark or file to be opened which is specified within double-quotes.
You can use href to point to a URL and allow the reader to view the page from the beginning, or, you can use href to point to a specific area of that page, indicated by a name of the bookmark, so, that the user goes straight to that section of the document.
Target: it is used to define where the linked document will be opened which is also specified within double-quotes.
Title: It holds the text that will be displayed as a hyperlink.
The text or an image that provides such a link is called hypertext or hyperlink.
<a href="name of the file to link i.e bookmark" target="location"> title of the link</a>
A hyperlink can be created by using an <a> anchor tag, which stands for anchor and has the following attributes:
href: It stands for hypertext reference which points the link to the bookmark/file from your PC. it contains the name of the bookmark or file to be opened which is specified within double-quotes.
You can use href to point to a URL and allow the reader to view the page from the beginning, or, you can use href to point to a specific area of that page, indicated by a name of the bookmark, so, that the user goes straight to that section of the document.
Target: it is used to define where the linked document will be opened which is also specified within double-quotes.
Title: It holds the text that will be displayed as a hyperlink.
Formatting the link:
Links can be formatted. To format the links,<body>tag contains attributes that specify the color for the hyperlink text depending upon the visiting status.
The following attributes of the <body> tag are used to provide color for the link.
LINK - Contains the link color which is specified in the <body> tag that has not yet been visited.
VLINK - Specifies the visited link color.
ALINK - Specifies the active link color.
The following attributes of the <body> tag are used to provide color for the link.
LINK - Contains the link color which is specified in the <body> tag that has not yet been visited.
VLINK - Specifies the visited link color.
ALINK - Specifies the active link color.
Sample program for linking documents:
1. Pointing the link to the file from PC:
Program:hyper.html
<html>
<head>
<title>hyperlink example</title>
</head>
<body>
<a href="link.html">CLICK HERE</a>
</body>
</html>
<html>
<head>
<title>hyperlink example</title>
</head>
<body>
<a href="link.html">CLICK HERE</a>
</body>
</html>
When we open "hyper.html" it will show the link "click here", and when we click it automatically opens the "link.html" file.
Program:link.html
<html>
<head>
<title>hyperlink example</title>
</head>
<body>
This is Open Source Software
</body>
</html>
2. Pointing the link to the bookmark/website:
<html>
<head>
<title>hyperlink example</title>
</head>
<h1>Some of my favorite web sites</h1>
<body bgcolor="violet">
<ul>
<li><a href="www.google.com">google</a>
<li><a href="www.yahoo.com">yahoo</a>
<li><a href="www.bing.com">bing</a>
<li><a href="www.oracle.com">oracle</a>
<li><a href="www.w3schools.com">web design</a>
</ul>
</body>
</html>
The output is:
<head>
<title>hyperlink example</title>
</head>
<h1>Some of my favorite web sites</h1>
<body bgcolor="violet">
<ul>
<li><a href="www.google.com">google</a>
<li><a href="www.yahoo.com">yahoo</a>
<li><a href="www.bing.com">bing</a>
<li><a href="www.oracle.com">oracle</a>
<li><a href="www.w3schools.com">web design</a>
</ul>
</body>
</html>
The output is:
No comments:
Post a Comment