Anchor tag <a> defines a hyperlink, which is used to navigate from one page to another. By default, hyperlink will appear as follows:
- Unvisited link is blue and underlined.
- Active link is red and underlined.
- Visited link is purple and underlined.
Example1: Link from one page to another
page1.html
<p>This is page1.</p>
<a href="page2.html">Click Here</a> for page2.
page2.html<a href="page2.html">Click Here</a> for page2.
<p>This is page2.</p>
<a href="page1.html">Click Here</a> for page1.
<a href="page1.html">Click Here</a> for page1.
Example2: Navigate within the page
page1.html
<p>This is page1.</p>
<a href="#cse">Click Here</a> for CSE Information.
....
....
....
<p id="cse">Computer Science and Engineering.</p>
<a href="#cse">Click Here</a> for CSE Information.
....
....
....
<p id="cse">Computer Science and Engineering.</p>
Example3: To a particular location of another page
page1.html
<p>This is page1.</p>
<a href="page2.html#cse">Click Here</a> for CSE Information in page2.
page2.html<a href="page2.html#cse">Click Here</a> for CSE Information in page2.
<p>This is page2.</p>
<a href="page1.html">Click Here</a> for page1.
....
....
....
<p id="cse">Computer Science and Engineering.</p>
<a href="page1.html">Click Here</a> for page1.
....
....
....
<p id="cse">Computer Science and Engineering.</p>