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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/html/a/HTML-a-tag-and-element.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics