HTML Links are found in nearly all web pages of Websites. HTML Links allows users to click and navigate way from one page to page.
Links or hyperlinks are a Reference from one web Page to another. HTML Links allow users to move seamlessly from one page to another, on any server anywhere in the world.
A HTML link has two ends, called anchors. The link starts at the source anchor and points to the destination anchor, which may be any web resource, an image, an audio, for example, or video clip, a PDF file, an HTML File document or an element within the document itself, and so on.
By default, links will appear as follow in most of the browsers:
- An active link is underlined and red.
- An unvisited link is underlined and blue.
- A visited link is underlined and purple.
However, you can overwrite this using CSS. Learn more about styling links.
HTML Links – Syntax
<a> tag defines a hyperlink. It has the following syntax:
The most important attribute of the
<a> element is the
href attribute, which indicates the link’s destination.
The link text is the part that will be visible to the reader.
Clicking on the link text, will send the reader to the specified URL address.
This example shows how to create a link to W3Schools.com:
By default, links will appear as follows in all browsers:
- An unvisited link is underlined and blue
- A visited link is underlined and purple
- An active link is underlined and red
Tip: Links can of course be styled with CSS, to get another look!
HTML Links – Hyperlinks
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.
Note: A link does not have to be text. A link can be an image or any other HTML element!
HTML Links – The target Attribute
By default, the linked page will be displayed in the current browser window. To change this, you must specify another target for the link.
target attribute specifies where to open the linked document.
target attribute can have one of the following values:
_top– Opens the document in the full body of the window
_self– Default. Opens the document in the same window/tab as it was clicked
_parent– Opens the document in the parent frame
_blank– Opens the document in a new window or tab
Use target=”_blank” to open the linked document in a new browser window or tab:
HTML Links Relative URLs v/s Absolute URLs
A URL determines the area of an objective put away on a nearby or arranged PC. The objective can be a record, registry, HTML page, picture, program, etc.
An outright URL contains all the data important to find an asset.
A general URL finds an asset utilizing an outright URL as a beginning stage. In actuality, the “total URL” of the objective is indicated by linking the supreme and relative URLs.
An outright URL utilizes the accompanying configuration: conspire://worker/way/asset
A general URL commonly comprises just of the way, and alternatively, the asset, yet no plan or worker. The accompanying tables characterize the individual pieces of the total URL design.
Indicates how the asset is to be gotten to.
Indicates the name of the PC where the asset is found.
Indicates the succession of indexes prompting the objective. On the off chance that asset is excluded, the objective is the last index in way.
Whenever included, asset is the objective, and is regularly the name of a record. It might be a basic record, containing a solitary parallel stream of bytes, or an organized archive, containing at least one stockpiles and twofold surges of bytes.
Both examples above are using an Absolute URL (a full web address) in the
A local link (a link to a page within the same website) is specified with a Relative URL (without the “https://www” part):
<p><a href=”html_images.asp”>HTML Images</a></p>
<p><a href=”/css/default.asp”>CSS Tutorial</a></p>
HTML Links – Use an Image as a Link
To use an image as a link, just put the
<img> tag inside the
<img src=”smiley.gif” alt=”HTML tutorial” style=”width:42px;height:42px;”>
HTML Link to an Email Address
mailto: inside the
href attribute to create a link that opens the user’s email program (to let them send a new email):
title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element.
Button as a HTML Link
More on Absolute URLs and Relative URLs
Use a full URL to link to a web page:
Link to a page located in the html folder on the current web site:
Link to a page located in the same folder as the current page:
You can read more about file paths in the chapter HTML File Paths.
- Use the
<a>element to define a link
- Use the
hrefattribute to define the link address
- Use the
targetattribute to define where to open the linked document
- Use the
<a>) to use an image as a link
- Use the
mailto:scheme inside the
hrefattribute to create a link that opens the user’s email program
HTML Link Tags
|<a>||Defines a hyperlink|
href attribute specifies the target of the link. Its value can be an absolute or relative URL.
An absolute URL is the URL that includes every part of the URL format, such as protocol, host name, and path of the document, e.g.,
https://www.example.com/form.php, etc. While, relative URLs are page-relative paths, e.g.,
images/smiley.png, and so on. A relative URL never includes the
Advantages of Using HTML Links
1. HTML Link are Easy to create and Use
HTML Links are easy to create, For the person who is learning web advancement, HTML is the above all else language that the individual will experience. one Can Create the links easily and place them in the code anywhere.
2. HTML Links are Free to use
Probably the greatest preferred position of HTML Links are that it is liberated from cost and there is no compelling reason to buy explicit programming. One ought not need to manage diverse modules needed to take a shot at any product as HTML doesn’t need any modules. So it is savvy according to business point of view as there is no expense of buying the permit if the entire site is created in HTML language.
3. HTML Links are supported by all Browsers
Practically all the programs the world over are upheld by HTML. So there is no compelling reason to stress over the site written in HTML for the program uphold as the site would effortlessly appear in all the programs if the program remembers to upgrade the site for the various programs. HTML gives a simple method to enhance the site in HTML as per programs to the web designers.
4. HTML Links are the Most Friendly Search Engine
HTML Links are the most well disposed web indexes in contrast with all the programming dialects accessible on the lookout (Search Engine agreeable methods conveying clients quality sites with applicable data when looked for a specific one). It is very simpler to make SEO consistent sites utilizing HTML than other programming dialects. HTML sites are simpler to peruse and gotten to by web crawlers and subsequently diminishes parsing time and the page load season of the site henceforth improving its presentation.
Lets us Move to the following Advantages of HTML.
1. HTML is Simple to Edit
HTML is anything but difficult to alter as there is no compelling reason to have an uncommon interface or stage to alter it. It is written in basic Notepad and henceforth can be just altered in any content manager like Notepad, Notepad++, and so forth
2. HTML can Integrate Easily with Other Languages
3. Show Changes Instantly
Perhaps the greatest preferred position of HTML is that one can see the progressions quickly by sparing it and reload the past HTML page. In contrast to other programming dialects, there is no compelling reason to run the entire code and discovering where the mistake is. For instance, on the off chance that you have made the word italic it will show up right away on the page once spared and reload.
4. HTML is User-Friendly
HTML is an easy to use programming language. One doesn’t have to have any earlier information on any language. Comprehension of basic English is adequate to work with it.
HTML is utilized in frontend improvement for over endless years before we have no different dialects accessible on the lookout for web advancement. In spite of the fact that HTML gives all the labels to the client to add everything in the page like a table, pictures, hyperlink, and so forth there were a few disadvantages which were canvassed in the most recent rendition of HTML, for example HTML5 which permits the client to embed a realistic, media, semantic components to grow amazing sites and improving UX reliably.
5. HTML is Lightweight
HTML is lightweight language. It has a high sign to clamor proportion when contrasted with different types of correspondence. It is additionally quicker to download HTML code, which implies it is exceptionally compressive moreover.
6. HTML is Basic of all Programming Languages
HTML Links are easy to create and one can use them easily on any website page. Just create them and use them efficiently. HTML Links are supported by all browsers and search engines to get the details of hyperlinks.