A web page hyperlink (or simply "link") consists of a word, group of words, or image that you can click on to jump to another document, page, or section. It is the means of website navigation. To establish link on web page <a> tag is used and href attribute must appear with <a> tag. Here
- <a> stands for anchor and
- HREF stands for hyper-reference
AttributesThe anchor tag contains many attributes which are listed below:
- download: It is used to specify the target link to download when the user clicks.
- href: here navigation path OR location is given to navigate the given link.
- name: It is used to specify the anchor name. It is not supported by HTML 5 you can use the global id attribute instead.
- target: It specifies the target link. It contains the value as described below
- _self: the current browsing context. (Default)
- _blank: usually a new tab, but users can configure browsers to open a new window instead.
- _parent: the parent browsing context of the current one. If no parent, behaves as _self.
- _top: the topmost browsing context (the "highest" context that’s an ancestor of the current one). If no ancestors, behaves as _self.
1. External Link
2. Internal Link
External LinkThese are links that navigates outside the page. In external link navigation could be on the same server OR to the another server.
hrefattribute to create a link that opens the user's default email program.
hrefattribute to create a link that opens the link in smart phone.
- Link: Used to define link color.
- Alink: Used to define active link color.
- Vlink: Used to define visited link color.
<title>Working with hyperlink in HTML</title>
<title>Setting Link Color</title>
<body alink = "#54A250" link = "#040404" vlink = "#F40633">
<p>Change Link Color</p>
<a href = "images/example2.gif" target = "_blank" >Click Me</a>
I am a normal link
Click Here to see Image
I am a link with target in new window
Click Here to open Image in new window/tab
I am a link download option
Click Here to download Image
I am a URL link
Click Here to see Image
I am a Email link
I am a Phone link
Change Link ColorClick Me
Internal Link OR Link on Same Page
- Create a link using <a> tag and give the location name using the attribute name/id/title.
- Link that location using <a> tag and href attribute. Must use # symbol before the location name (create in step 1) to work the hyperlink properly.