HTML » Tags » a

Version: 2.0, 3.2, 4.0

Compability: Explorer 4, 5  Netscape 4, 6

Syntax:
<a> ... </a>

The <a> tag is called the anchor tag and it is most commonly used with the href attribute to create a hypertext link (usually referred to as just a link). By simply clicking on the link with a mouse or using a keyboard command, you can travel from one page to another page on the same web site or a different one.

Additionally, you can create links to servers using different protocols, such as FTP or Telnet, by using ftp:// or telnet:// in place of http:// in the URL specified by the href attribute. By default, the new page is normally displayed in the same window or frame, unless you specify otherwise using the target attribute.

Note that links cannot be nested. An <a>...</a> element cannot contain other a elements.
 
You can insert characters, images, line breaks (<br> or <p>), and text between the opening and closing a tags. It is recommended that you should not insert Cascading Style Sheets code or any other HTML tags between the opening and closing tags. Rather, place all such tags outside of the a element.
 
The closing tag is mandatory.
 

Examples

Code:
<a href="http://www.devguru.com" target="_blank">DevGuru</a>
Output:
DevGuru
Explanation:

This example demonstrates the code for creating a link. The target attribute is used to open the linked document in a new window.

Language(s): HTML

See Also: