the <a> holds for anchor tag .The <a> tag in HTML is used to create a hyperlink on the webpage. This hyperlink is used to link the webpage to other webpages. It’s either used to provide an absolute reference or a relative reference as its “href” value
Syntax:
<a href = "link"> Link Name </a>
Attribute values : The anchor tag contains many attributes which are listed below:
- charset: This attribute is used to specifies the character-set. It is not supported by HTML 5.
- download: It is used to specify the target link to download when user click.
- hreflang: It is used to specify the language of linked document.
- media: It is used to specify the linked media.
- coords: It is used to specify the coordinate of links. It is not supported by HTML 5.
- name: It is used to specify the anchor name. It is not supported by HTML 5 you can use the global id attribute instead.
- rel: It is used to specify the relation between current document and linked document.
- shape: It is used to specify the shape of link. It is not supported by HTML 5.
- type: It is used to specify the type of links.
- target: It specify the target link.
- rev: It is used to specify the relation between linked document and current document. It is not supported by HTML 5.
Example 1:
html
<!DOCTYPE html> < html > < head > < title >anchor tag</ title > </ head > < body > < p >Welcome to GeeksforGeeks </ a > </ p > </ body > </ html > |
Output:
Welcome to GeeksforGeeks
Example 2:
html
<!DOCTYPE html> < html > < head > < title >anchor tag</ title > </ head > < body > < p >Click on the image to open web page.</ p > <!-- anchor tag starts here --> < img src = width = "300" height = "250" > </ a > <!-- anchor tag ends here --> </ body > </ html > |
Output:
Most browsers display the <a> tag element with the following default setting.
html
< style > a:link,a:visited { color: (internal value); text-decoration: underline; cursor: auto; } a:link:active,a:visited:active { color: (internal value); } </ style > |
Supported Browsers: The browser supported by <a> tag are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari