HTML a name Attribute
HTML <a> tag
Definition and Usage
The name attribute is an identification for the URL (web resource).
The name attribute can be used to link from one part of a page to another.
The href or the name attribute must be present in the <a> tag
Syntax
Syntax Example
Attribute Values
Value |
Description |
identifier |
The name/identifier of the link. Naming rules:
- Must begin with a letter A-Z or a-z
- Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".")
- Values are case-sensitive
|
Browser Support
The attribute is supported in all major browsers.
Example
Source |
Output |
<p><a name="example">Example</a></p>
|
Example
|
Try-It-Yourself Demos
a name attribute
example
How to use the name attribute to link to a location on the same page (an anchor).
HTML <a> tag
|