The example of anchor tag in Web page
The Example of anchor tag in HTML
Anchor tag is used to transfer control from current page to another page. Anchor tag opens another webpage or another file PDF, Doc, Excel or any HTML page in same window or new window.
Anchor tag use href attribute to find URL of another page where it has to visit. It is also called hyperlink Href attribute help to create a hyperlink with another page.
Anchor tag is used for creating bookmarking with name attribute which is followed by #. This bookmarking works within the same page and no extra webpage is called in bookmark. If we want to give path of another page we need to use href attribute. This href solve all problems to send us to one page to another destination page.
Anchor tag is supported by all web browsers. This browser can be firefox, Internet explorer, mozilla, netscape, opera, and google chrome.
By default, color of hyperlink is dark blue and is shown with underline.
If link is visited by someone, color of link will be changed to purple.
If link is active, color of link will be changed o red or orange.
These color is slightly change by browser to browser.
Anchor tag of html is defined by all standard HTML DTD versions. But some attribute is not available in DTD version. It is explained in below section.
Attribute of Anchor Tag
|charset||char_encoding (iso-8859-1,utf-8)||character encoding of linked|
|type||content types||MIME Content Type|
|name||Property_name||Name of anchor tag link|
|href||URL||URL path for linked web page|
|hreflang||language_code||Language Code of the linked page|
|Linked page open in window|
|rel||LinkTypes||relationship between the current document and the linked document|
|rev||LinkTypes||relationship between the linked document and the current document|
|accesskey||Character||accessibility key character (Shortcut key character)|
|shape||Shape||for use with client-side image maps|
|coords||coordinates||Define coordinates of the link|
|tabindex||NUMBER||position in tabbing order|
Common Attribute of Anchor Tag
|id||ID||unique id document for link element|
|class||classname||list of CSS classes|
|style||StyleSheet||associated style information of style tags|
|title||Text||information about an element shown on mouse over cursor|
|lang||LanguageCode||Language Code of the element|
|dir||(ltr|rtl)||direction for weak/neutral text|
Events Attribute of Anchor Tag
|onfocus||event||Event Fire on element got the focus|
|onblur||event||Event Fire on element lost the focus|
|onclick||event||Event Fire on mouse button was clicked|
|ondblclick||event||Event Fire on a mouse button was double clicked|
|onmousedown||event||Event Fire on a mouse button was pressed down|
|onmouseup||event||Event Fire on a mouse button was released|
|onmouseover||event||Event Fire on a mouse was moved onto|
|onmousemove||event||Event Fire on a mouse was moved within|
|onmouseout||event||Event Fire on a mouse was moved away|
|onkeypress||event||Event Fire on a key was pressed and released|
|onkeydown||event||Event Fire on a key was pressed down|
|onkeyup||event||Event Fire on a key was released|