Defines a link to the same or to another document, or defines a destination anchor.
The a (anchor) tag is one of the most useful HTML elements.
The following table contains protocols that can be used in the value of the href attribute.
Commonly used protocols:
- Inner links:
The inner links are useful to create a destination point where the browser may jump directly (scrolling the target to the top of the page if possible). The target must be an anchor tag with the name attribute specified, and if you want to jump to this point, you must only insert the value of the name attribute after a # (hash mark) sign in the href attribute of the source anchor or area element, as shown in Example 2.
- http, https:
Link to an external webpage, as shown in Example 1.
Opens a file transfer session (an FTP site), with or without a username and password, as shown in Example 4.
Allows downloading a file from the specified location. Because of security restrictions, most browsers allow downloading files only from the same domain where the original document is placed.
Opens the 'new message' dialog of user's default e-mail application with the specified e-mail address as the recipient, as shown in Example 3.
If you want to see the HTML tags by categories, please visit this page.
This element requires a closing tag.
Example HTML code 1:
This example shows how to create an external link:
Example HTML code 2:
This example shows how to jump to a destination anchor on the current page:
Example HTML code 3:
This example shows how to send mail with the anchor tag:
Example HTML code 4:
This example shows how to create a link to a protected ftp:
Example HTML code 5:
User Contributed Comments