Anchor tag is a traditional tag used from the initial stage of HTML to give the navigation option to the user. It allows user to jump a page from and to. This page will describe its attributes and their significance.
Reference:
w3schools.com
w3.org
Attribute | Value | Description |
---|---|---|
href | absolute URL | different domain, which start with http protocol href="http://www.differentsite.com/test.asp" |
relative URL | url link on same domain, which doesnot need to start with http protocol href="homepage.html" href= example: href="http://www.example.com/2013/test/homepage.html" href="/homepage.html" href= example: href="http://www.example.com/homepage.html" href="//homepage.org" href="http:"+"//homepage.org" example: href="http://homepage.org" href="./homepage.html" href= example: href="http://www.example.com/2013/test/homepage.html" href="../homepage.html" href= example: href="http://www.example.com/2013/homepage.html" | |
anchor URL | href="#top" href= example:href="http://www.example.com#top" | |
mailto protocol | href="mailto:user@example.com? subject=MessageTitle& body=Message Content" | |
target | _blank | Opens the linked document in a new window or tab |
_self(default) | Opens the linked document in the same frame as it was clicked | |
_parent | Opens the linked document in the parent frame | |
_top | Opens the linked document in the full body of the window | |
framename | Opens the linked document in a named frame | |
charset | char_encoding | Not supported in HTML5. Specifies the character-set of a linked document |
coords (supported in Firefox and Opera only) | x1,y1,x2,y2 | If the shape attribute is set to "rect", it specifies the coordinates of the top-left corner and the bottom-right corner of the rectangle |
x,y,radius | If the shape attribute is set to "circle", it specifies the coordinates of the circle center and the radius | |
x1,y1,x2,y2,..,xn,yn | If the shape attribute is set to "poly", it specifies the coordinates of the edges of the polygon. If the first and last coordinate pairs are not the same, the browser must add the last coordinate pair to close the polygon | |
hreflang | language_code | A two-letter language code that specifies the language of the linked document. To view all available language codes, go to w3schools Language code reference. |
media | media_query | Specifies what media/device the linked document is optimized for. more |
name | section_name | Not supported in HTML5. Specifies the name of an anchor |
rel | alternate | Links to an alternate version of the document (i.e. print page, translated or mirror) |
author | Links to the author of the document | |
bookmark | Permanent URL used for bookmarking | |
help | Links to a help document | |
license | Links to copyright information for the document | |
next | The next document in a selection | |
nofollow | Links to an unendorsed document, like a paid link.("nofollow" is used by Google, to specify that the Google search spider should not follow that link) | |
noreferrer | Specifies that the browser should not send a HTTP referer header if the user follows the hyperlink | |
prefetch | Specifies that the target document should be cached | |
prev | The previous document in a selection | |
search | Links to a search tool for the document | |
tag | A tag (keyword) for the current document | |
rev | text | Not supported in HTML5. Specifies the relationship between the linked document and the current document |
shape | default rect circle poly |
Not supported in HTML5. Specifies the shape of a link |
type | MIME_type | The MIME type of the linked document. Look at IANA MIME types for a complete list of standard MIME types |