�HTML – TEXT LINKS ��
Amity School of Engineering & Technology
� TEXT LINKS ��
Amity School of Engineering & Technology
�Linking Documents
A link is specified using HTML tag <a>. This tag is called anchor tag and anything between the opening <a> tag and the closing </a> tag becomes part of the link and a user can click that part to reach to the linked document. Following is the simple syntax to use <a> tag.
<a href="Document URL" ... attributes-list>Link Text</a>
Amity School of Engineering & Technology
Amity School of Engineering & Technology
�The target Attribute
We have used target attribute in our previous example. This attribute is used to specify the location where linked document is opened. Following are the possible options:
Amity School of Engineering & Technology
following example to understand basic difference in few options given for target attribute.
Amity School of Engineering & Technology
�Use of Base Path
When you link HTML documents related to the same website, it is not required to give a complete URL for every link. You can get rid of it if you use <base> tag in your HTML document header. This tag is used to give a base path for all the links. So your browser will concatenate given relative path to this base path and will make a complete URL.
Amity School of Engineering & Technology
Following example makes use of <base> tag to specify base URL and later we can use relative path to all the links instead of giving complete URL for every link.
Amity School of Engineering & Technology
�Linking to a Page Section
You can create a link to a particular section of a given webpage by using name attribute. This is a two-step process.
<a name="top"></a>
<a href="#top">Go to the Top</a>
This will produce following link, where you can click on the link generated Go to the Top to reach to the top of the HTML Text Link tutorial.
Amity School of Engineering & Technology
�Setting Link Colors
You can set colors of your links, active links and visited links using link, alink and vlink attributes of <body> tag.
Save the following in test.htm and open it in any web browser to see how link, alink and vlink attributes work.
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Thanks
Amity School of Engineering & Technology