Use the <a> tag to create an anchor in HTML. The <a> tag is used for creating a hyperlink to either another document or somewhere within the current document.
The following are the attributes −
Attribute | Value | Description |
---|---|---|
Charset | character_encoding | Defines the character encoding of the linked document |
Cords | if shape = "rect" then coords = "left, top, right, bottom" | Specifies the coordinates appropriate to the shape attribute to define a region of an image for image maps. |
download![]() | Filename | This downloads the target when user clicks on the hyperlink. |
Href | URL | Specifies the URL of a page or the name of the anchor that the link goes to. |
hreflang | language_code | Language code of the destination URL |
media![]() | media_query | It specifies what media the linked document is optimized for |
Name | section name | Marks an area of the page that a link jumps to. |
Rel | alternate designates stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | Describes the relationship between the current document and the destination URI. |
rev | alternate designates stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | Specifies the relationship between the target URL and the current document. |
Shape | rect rectangle circ circle poly polygon | Specifies the shape of the image map |
Target | _blank _parent _self _top | Where to open the target URL. |
type![]() | mime_type | Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL |
You can try to run the following code to learn how to include an anchor in HTML −
<!DOCTYPE html> <html> <head> <title>HTML a Tag</title> </head> <body> <p>Welcome to <a href = "https://www.qries.com">Qries</a></p> </body> </html>