HTML LINKS ARE HYPERLINKS.
YOU CAN CLICK ON A LINK AND JUMP TO ANOTHER DOCUMENT.WHEN YOU MOVE THE MOUSE OVER A LINK, THE MOUSE ARROW WILL TURN INTO A LITTLE HAND.
<a href=”url“>link text</a>
<a href=”https://www.w3schools.com/html/”>Visit our HTML tutorial</a>
The href attribute specifies the destination address (https://www.google.com) of the link.
The link text is the visible part (Visit our HTML tutorial).
Clicking on the link text will send you to the specified address.
An unvisited link is underlined and blue
A visited link is underlined and purple
An active link is underlined and red
HTML LINKS – THE TARGET ATTRIBUTE
The target attribute specifies where to open the linked document.
The target attribute can have one of the following values:
_blank – Opens the linked document in a new window or tab
_self – Opens the linked document in the same window/tab as it was clicked (this is default)
_parent – Opens the linked document in the parent frame
_top – Opens the linked document in the full body of the window
framename – Opens the linked document in a named frame
This example will open the linked document in a new browser window/tab:
<a href=”https://www.google.com/” target=”_blank”>Visit Google!</a>
Tip: If your webpage is locked in a frame, you can use target="_top" to break out of the frame:
<a href=”https://www.google.com” target=”_top”>Visit Google!</a>
HTML LINKS – IMAGE AS LINK
It is common to use images as links:
<a href=”default.asp”>
<img src=”smiley.gif” alt=”HTML tutorial” style=”width:42px;height:42px;border:0;”>
</a>
The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element.
<a href=”https://www.interviewclassroom.com” title=”Go to Interview Classroom Website”>Visit our Website</a>
HTML LINKS – CREATE A BOOKMARK
HTML bookmarks are used to allow readers to jump to specific parts of a Web page.
Bookmarks can be useful if your webpage is very long.
To make a bookmark, you must first create the bookmark, and then add a link to it.
When the link is clicked, the page will scroll to the location with the bookmark.
First, create a bookmark with the id attribute:
<h2 id=”C4″>Chapter 4</h2>
Then, add a link to the bookmark (“Jump to Chapter 4”), from within the same page:
<a href=”#C4″>Jump to Website</a>
Or, add a link to the bookmark (“Jump to Website”), from another page:
EXAMPLE<A HREF=”HTML_DEMO.HTML#C4″>JUMP TO CHAPTER 4</A>