Loading...

TapGen

Free online tutorials

img

HTML links, or hyperlinks, found in all web pages to navigate between pages or resources like images, videos. 

Hyperlinks allow users to move from one page to another page, or to different sections of the same page. 

How to create a link in HTML?

To create a hyperlink in HTML, using the `<a>` anchor) tag with the `href` attribute specifies the URL or location you want to connect.

Here’s the basic syntax:

                                        
                                            <a href="home.html">Home</a>
                                        
                                    

User will go to the "home.html" page after clicking on Home Button. When you move over the mouse into a link, the mouse arrow will changed into a hand as default and link color will be blue and underlined .You can change that latter using CSS. 

Link Attribute:

You can learn about the Attribute with our this article What is an attribute in HTML

  • href: Specifies the destination URL.

href attribute is the most important attribute of the <a> Tag. 

The target Attribute Of a Link

By default, the linked page will be displayed in the current window. if you want to change this you need to use target Attribute for thtat.

Open Link in a New Tab/Window: For example, reader want to open the link in a new window.

                                        
                                          <a href="https://www.tapgen.xyz" target="_blank">Visit tapgen.xyz</a>
                                    

Look at the target="_blank" attribute here. thats tells the browser to open the link in a new tab or window. 

the target attribute have more common values. 

  • _self (default): Opens the link in the same frame or window.
  • _blank: Opens the link in a new window or tab.
  • _parent: Opens the link in the parent frame.
  • _top: Opens the link in the full window.

a link doesn’t have to be just text. You can use other HTML elements, such as images or buttons, as clickable links. Here’s how you can do that:

Using an Image as a Link:

                                        
 <a href="https://www.example.com">
  <img src="image.jpg" alt="Description of the image">
</a>
 
                                    

To use an image as a link, wrap it in an <a> tag:

Link to an Email Address: This creates a link that opens the user’s default email.

                                        
                                            <a href="mailto:someone@example.com">Send Email</a> 
                                    

Hyperlinks are a fundamental part of HTML and web navigation, making it essential to use them effectively and accessibly.

If you have any other questions or need further examples, let us know and upload the question in our forum tapgen.xyz

Learn to code with the world's largest web developer site. Not sure where to begin? HTML is The language for building web pages Learn HTML Tutorial with Tapgen.

=================================
Share This Article
icon

New to Communities?

Join the community