Home » Learn Code » HTML5 » What are HTML Links? How to add Links in HTML?

What are HTML Links? How to add Links in HTML?

html links

Today in this chapter, I am going to show you how to add links in HTML web page. So, let go ahead and see what are HTML links?

So Let’s Get Started:

What are HTML Links?

A link is an HTML object that allows us to jump on different documents and webpages on the internet. HTML Links can exist on every web page of any website. So, guys links are everywhere on the internet. When we click the links then these links take us to a new document or a webpage. So, without links internet has nowhere to go. These links are called hyperlinks in HTML.

Why we use links?

We use links to add different files in HTML like video files, images, audio files, and webpages links on our website. Also, we can add social media links like Facebook, Twitter, yahoo. And also YouTube links almost any type of links we can add in our website.

How to add links in HTML?

HTML links are hyperlinks. We use ‘a’ tag with the most important ‘href’ attribute to add a link in HTML.

Syntax:

<a href="site url"> 
link text 
</a>

Remember: ‘a’ tag with ‘href’ attribute. If you don’t know what are HTML attributes then click the link to see: What are HTML Attributes?

Note: A link can also be an image.

Let’s See the video of adding links in HTML:

So, you saw in the above video that how to add a link in HTML and attribute use in the link.

Target Attribute:

Firstly, we used “_blank” in target attribute to open a link in a new window or tab. Then, we used “_self” in target attribute to open a link in the same window. By the way, by default links are open in the same tab or window, so no need to use “_self” value in target attribute.

Title Attribute:

We use the title attribute in ‘a’ tag to give the title to a link. After adding the title attribute, whenever you mouse over the link then a small text shows up where your link title is written.

How to use an image as a hyperlink in HTML:

Note: Also we can use the image as a link. So, just write img tag with src attribute inside the ‘a’ tag instead of link text. Absolutely images use as a link a lot in HTML. You always see images with links in your browser. When you click the image that image will take you to a new location. That’s the image link.

We can also add links to icons. In our CSS tutorials we will create icon link like social media icons. Whenever you will click on the icon it will take you to social media page. Like Facebook page, twitter page etc.

Also, check How to add CSS in HTML? What are the three ways to insert CSS in HTML?

So, I hope you understood well that what are links and how to use them in HTML. Use google for more information. And Take care. Meet in the next tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *