HTML links are also called hyperlink.
HTML links are connected from one webpage or web resource to another. By clicking a hyperlink you jump to another webpage or web resource.
We generally use hypertext (Hypertext is a text within hyperlink) to be clicked upon to go to a new web page.
HTML link Syntax:
We use <a> tag to define hyperlink.<a> tag is known as Anchor tag:
- href is attribute of anchor tag and is used to give destination of link
- Content in between opening and closing of <a> tag is clickable and visible part of hyperlink
Apart from href
attribute there are other attributes too.
- HTML Link - target Attribute
- HTML Link - title Attribute
Let's discuss these attributes.
HTML Link - Target Attribute
target attribute is used to specify where the linked document should be opened. Whether it will open in the same tab or on a different tab.
This attribute has following values:
- _self - It opens the linked document to the same tab.It's also default value.
- _blank - It opens the linked document to a different tab or window.
- _parent - It opens the linked document in the parent frame.
- _top - It will open the linked document in the full body of the window.
Here is an example and you can change different values to see the difference in the practice section.
HTML Link - title attribute
title attribute provides additional information about HTML link.When user takes its cursor over the link then value provided for title attribute is shown in a box.
Image as Hyperlink
As mentioned above we can use image also as HTML link.Here is an example:
HTML Link - Bookmark
You can also use HTML links to create bookmarks on the same web page. Clicking on the link will instantly take you to that part of the web page.
Here is an example that will take you to HTML link syntax.
click here to jump to HTML link syntax.
Here is how to create a web page bookmark.
- First create an id to the part of the web page where you want to jump.
- Now in <a> tag provide href value="#id_name"