HTML Links, or Hyperlinks, are one of the most essential elements of web development. They allow users to navigate from one page to another or even to an entirely different website. Using links, you can connect web pages and create a seamless browsing experience.
HTML links are hyperlinks.
You can click on a link and jump to another document.
When you move the mouse over a link, the mouse arrow will turn into a little hand.
To create a hyperlink, you use the <a>
(anchor) tag. The basic syntax looks like this:
<a href="https://example.com">Click Here</a>
Here’s what each part means:
href
: Specifies the URL of the page the link points to.<a>
tags is what users see and click.The target
attribute specifies where to open the linked document.
The target
attribute can have one of the following values:
_self
- Default. Opens the document in the same window/tab as it was clicked_blank
- Opens the document in a new window or tab_parent
- Opens the document in the parent frame_top
- Opens the document in the full body of the windowInternal links point to pages within the same website. For example:
<a href="/about.html">About Us</a>
These links help organize your website and improve navigation.
External links point to pages on a different website. For example:
<a href="https://www.w3schools.com" target="_blank">Learn More</a>
The target="_blank"
attribute opens the link in a new tab.
Anchor links navigate to a specific section within the same page. Example:
<a href="#contact">Go to Contact Section</a>
Defines how the link opens:
_self
: Default. Opens in the same window._blank
: Opens in a new tab.Adds a tooltip on hover:
<a href="https://example.com" title="Visit Example">Example</a>
<a>
element to define a linkhref
attribute to define the link addresstarget
attribute to define where to open the linked document<img>
element (inside <a>
) to use an image as a linkmailto:
scheme inside the href
attribute to create a link that opens the user's email programInternal links navigate to pages within the same website, while external links point to pages on a different website.
Use the target="_blank"
attribute in the <a>
tag.
Follow these tips to create links that are both user-friendly and optimized for search engines:
<a href="https://vasusoft.com">Visit Vasusoft</a>
<a href="#services">Our Services</a> <h2 id="services">Services Section</h2>