How to Insert Hyperlink in HTML Page?
Do you want to know how to insert hyperlink in HTML page? Don't worry we will learn everything about links and how you can insert them into your html pages.
What is a link? #
Basically a link is a connection from one website to another and allows users to click on it to visit that website.
How to create a link to a website? #
To make a hyperlink in an HTML page, use the <a> </a> tag. Whatever text gets added inside this tag, will work as a hyperlink. The most important attribute of the <a> element is the href attribute, which indicates the destination of the link.
HTML Links - Syntax #
<a href="url">link text</a>
- href : The href attribute is used to indicate the destination address of the link. "href" stands for Hypertext Reference.
- link text : Link text is the part of the link that will be visible to the reader. By clicking on this link text, readers will be redirected to the specified URL address.
The following example shows how to create a link to 3schools.in #<a href="https://www.3schools.in">Visit 3schools.in</a>
Add an image as a link in HTML page. #
To hyperlink an image we don't need to do anything just use the <img> tag inside the anchor (<a>) tag.
The following example add an image as a link in HTML page. #<a href="https://www.3schools.in"> <img src="https://app.3schools.in/logo.png" height="50" width="50"> </a>
HTML Links - The target Attribute #
By default, the linked page will be open in the same window or tab. To change it, you must change its value. The target attribute has four values _self _blank _parent and _top.
The following example will open the linked document in a new window or tab. #<a href="https://www.3schools.in" target="_blank">Visit 3schools.in</a>