HTML <a> tag
The <a> tag is used to display links on a page.
You can create links to other resources on the web (pages, images, etc.) and also links within the page itself.
NOTE: The default link style is blue and underlined for unvisited links, purple and underlined for visited links, and red and underlined for active links (the moment the link is clicked on)
Attributes
| Attribute | Possible values | Description |
|---|---|---|
| charset | encodingType | Specifies the character encoding of the URL the link links to |
| coords | numericalCoordinates | Sets the coordinates for a link in an image map |
| href | location | The URL that you are linking to |
| hreflang | langCode | base language of the URL that you are linking to |
| name | anchorName | A named anchor to jump to (when linking within the same page) |
| rel | alternate, designates, stylesheet, start, next, prev, contents, index, glossary, copyright, chapter, section, subsection, appendix, help, bookmark | Specifies a relationship between the page the link is on and what you are linking to. |
| rev | alternate, designates, stylesheet, start, next, prev, contents, index, glossary, copyright, chapter, section, subsection, appendix, help, bookmark | Specifies a relationship between what you are linking to and the page the link is on. |
| shape | default, circle, rect, poly | Sets the shape for a link in an image map |
| target | _blank, _self, _parent, _top | Sets where a link will open |
| type | mimeType | Specifies the MIME type of the content at the URL you are linking to |
Standard attributes
accesskey, class, dir, id, lang, style, tabindex, title, xml:lang
For more information on standard attributes, check out our HTML standard attributes reference page.
Event attributes
onblur, onclick, ondblclick, onfocus, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress, onkeyup
For more information on event attributes, check out our HTML event attributes reference page.
Example
Tips & notes
Use descriptive text for links. Don't make link text something like "Click here" or "Second page" instead make it something descriptive like in the above example.