Page 109 - Plus_V2.2_C8_Flipbook
P. 109

In the above example, the word ‘Contact Us’ is hyperlinked to the document ‘contact.html’. When the
                 word ‘Contact Us’ is clicked, it opens ‘contact.html’.

                 HREF Attribute

                 The attribute that must be used inside the <A> tag is ‘href’ which stands for hypertext reference. This
                 attribute takes the URL (Uniform Resource Locator) of the web page that is to be linked as its value.

                 URL is the address (where the web page is saved) of the web page. URL can be of two types:
                    Absolute URL: It denotes the complete path of the web page including directory name where the
                   web page is saved. For example, if a web page, named Home.html, is saved in a folder named
                   Pages under the E: drive of your computer, then the URL of the web page will be E:/Pages/Home.
                   html.
                   <A HREF = "E:/Pages/Home.html"> Home </A>

                    Relative URL: It denotes a particular web page name within the website only. For example,

                   <A HREF = "Home.html"> Home </A>
                 In that case, it is necessary both the web pages, one that contains the link and the other that is to be
                 linked, must be saved at the same location.


                 TITLE Attribute

                 This attribute provides tooltip information for the link. In the browser window, if the user moves the
                 mouse over a link, a tooltip showing the information specified by the TITLE attribute will be displayed.
                 For example,
                 <A HREF="Home.html" TITLE="Click Here"> Home </A>


                 ID Attribute

                 This attribute is used to specify the anchor point that is to be linked within a web page. For example,
                 <A ID="top"> </A>
                 Where, top is the anchor point. You can use any other word of your choice. While linking this anchor
                 point, the hash (#) symbol will be used with the HREF attribute. For example,

                 <A HREF="#top"> Click Here </A>

                 TARGET Attribute

                 By default, the link opens in the current window. If you want the link to open in another window, you
                 need to add a target. This is specified using the TARGET attribute.
                    _blank: Opens the linked web page in a new window or tab of the web browser.

                    _parent: Opens the linked web page in a parent window or tab of the web browser.
                    _self: Opens the linked web page in current window or tab.

                    _top: Opens the linked web page in the window that is on top in all the windows.

                 Now, let us see an example using the <a> tag with the respective attributes and CSS properties.



                                                                                 Links, Frames, and Forms in HTML5  107
   104   105   106   107   108   109   110   111   112   113   114