Links are the clickable text that can lead you to a specific point on the same page or another page.
HTML links are also known as hyper or anchor link. Links are generally used to jump to a specific point on the same or another page. When you hover the move over the link the mouse icon change from default to a clickable hand. Images and glyph icons can also be used as a link.
To create a link we use
element which stands for the anchor tag. Syntax:
<a href="URL"> Text</a>
hrefattribute, because it specifies the URL or destination of the link.
<a href="https://www.techgeekbuzz.com"> TechGeekBuzz </a> <a href="https://www.google.com"> Google </a>
Link Target Attribute
attribute specifies how the link will be opened on the browser when the user clicks on it. There are four values associated with the
_self: It is the default target value, and this opens the target URL on the same tab and window.
_blank: It opens the link URL at the same window and new tab.
_parent: It opens the Link URL in the parent frame.
_top: It opens the link URL in the full body of the window.
<a href="https://www.techgeekbuzz.com/" target="_blank"> TechGeekBuzz</a>
An image could also be used as a link.
<a href="https://www.techgeekbuzz.com/"> <img src="image.jpg" style="width:30px; height:30px;"> </a>
It is essential to resize your image using the CSS property when you use the image a Link.
In HTML 5 we have an element called <button>, which is used to create buttons on the web page. Buttons are also be used to present links.
<a href="https://www.techgeekbuzz.com/" target="_blank"> <button>TechGeekBuzz</button> </a>
Link Title attribute
We use the
attribute to provide additional information about the link. The user can see the information by hovering the mouse over the link.
<a href="https://www.techgeekbuzz.com/" title="This Will lead you to techgeekbuzz official home page"> Techgeekbuzz </a>
Link to the Same Page
element can also be used to point to a section of the same web page. This technique often uses when the page contains too much content, and we want to provide some link that could take the user directly to a specific section of the page.
<a href="#id name"> Link Name</a> <p id ="Id Name"> content</p>
<a href="#hyperlinks"> Hyperlinks </a> <p id="hyperlinks"> This is the content about hyperlinks</p>
- Links are the clickable elements that can lead to a specific URL or location.
- In HTML links can be created using <a> anchor tag.
- href attribute contains the destination URL or location.
- title attribute provides additional information about the link.
- <a> tag can also be used to jump to a specific location on the same web page.