Link in HTML
Link in HTML
Web pages are linked to one another through Hypertext Links. Section of text or image in the HTML document can be linked to an external document or to a specific place within the same document. The text or image that provides such linkage is known as Hypertext or Hotspot. HTML provides <A>Anchor Tag to create links. The format of using anchor tag is as follows:
<A HREF ="URL"> Make Me The Link </A>
HREF (Hyper Link Reference) is a mandatory attribute used to refer the URL of the resource. URL (Uniform Resource Locator) is an address tells the browser about the file to link to. It identifies file locations (Addresses) on the web or on the local hard drive. These addresses can be those of HTML documents or elements such as images, scripts, applets and other files. It is always enclosed in quotes.
Attribute of <a> tag:
Target: it is used to specify the location of page where linked data will be open/ display. The possible values are: ‘new’, ‘_blank’, ‘self’, ‘parent’. Default target is set as ‘self’.
Name: to define the name of link by which we can bookmark the location and can jump to this location.
Linking a text to a web site / an external document
<A HREF =http://www.infomaxacademy.com target= “_blank”>Link to Website of Infomax Academy</A>
In the above example the link text “Links to Home page of infomax academy” would appear underlined and in a color different from any other text in the document to distinguish a link from normal text. Also you would find that the mouse pointer changes into a hand like symbol when taken over the hyperlink.
Linking an image to web site
An image can be linked to a web site or HTML document.
<A HREF ="http://www.infomaxacademy.com"><IMG SRC=”infomax_logo.png” ></A>
Linking (jumping) to a specific place within the same document
Sometimes, it is required to jump different sections in the same document. For this it needs two steps, first; identify section with a name and or second; use jumps to the location using the name used.
The syntax is:
<A HREF="#section_name"> link to another section of the same document </A>
This link text jumps to the section named with HREF on click. The # symbol before the section name is must.
<A NAME="section_name"> Beginning of the section </A>
The NAME attribute is used to identify a section with a name. It is a unique identifier within the document for the anchor. One can also jump to a specific section of different document specifying the path on HREF attribute.
Within the same document: <A HREF="#section_name">
Same folder, but different document: <AHREF="document.html#section_name">
Different folder, different document:
A different server:
- Text with heavy text jargons
- Text more than 1000 words
- Text which contains link to other texts
- None of the above
- None of the Above