HTML Links
HTML links are very important for all webpages. Different webpages of a website are interconnected using links.
With the help of links users can move from one webpage to the other
To make an HTML link we make use of the <a> tag and its attribute href
HTML links can be used to link to your internal pages or external URL
Example
<!--example of internal link--> <p><a href="myinternalfile.html">click here to view my details</a></p> <!--example of External link--> <p><a href="https://www.google.com">click here to visit google</a></p> <!--example of opening a link in another browser tab--> <p><a href="https://www.google.com" target="_blank">click here to visit google</a></p>
<a> tag defines a HYPER LINK
Create bookmark in HTML
Book marks helps to link items from the same website
Two steps have to be done to achieve it
- Create the bookmark with ID
- Create the link pointing to the ID
So lets create a bookmark
1. Create the bookmark using the ID attribute
Example <p id=”mybookmark”>Linking is fun</p>
2. Now create the link using the <a> tag
Example <a href=”#mybookmark”>visit my bookmark</a>
you can also add a link to a bookmark on another page
<a href=”demo.html#chapter2″>Lets visit chapter 2</a>