HTML a tag and element
1. HTML a element defines a hyperlink in an HTML document.
2. a element starts with <a> tag and ends with </a> tag.
3. Value of the href attribute of an a element holds the target resource of the hyperlink.
4. Text written within the <a> and </a> tags is called anchor text.
Syntax
<a href="linked_resource">Text or Image </a>
Whether both start and end tags are required
Both start and end tags are required.
Can contain
HTML a element can contain inline elements except a.
Can reside within
HTML a element can reside within Block-level elements as well as inline elements except a and button.
Attributes
Attributes specific to this element
name, href, hreflang, type, rel, rev, charset.
Identifiers
language information and text direction
Title
Style
Events
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.
Image maps
Target frame information
Tabbing navigation
Access keys
Example of using HTML a element
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>html-a-tag-example</title>
</head>
<body>
<p>We are learning HTML at <a href="/index.php">w3resource.com</a></p>
</body>
</html>
Result

View this example in a separate browser window
Pictorial presentation

Previous: HTML td tag and element
Next:
HTML link tag and element
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook