HTML Menu


Anchor Tag in HTML


  • The most important capability of HTML is its ability to create hyperlinks. Hyperlinks can be applied to either text or images.
  • Anchor tag is used to create link between two documents, Minimum it requires a parameter is "href" which indicates destination document.

    format:
    <a href="filename/path" [alt="text"] > -------</a>

    "href" is mandatory argument and it specifies the path or url of the document.
    "alt" is optinal argument and it specifies the alternative text.
  • Sometimes images can be used as hyperlinks.

    format:
    <a href="filename/path" [alt="text"] ><img src="imgname.jpg" /></a>

Example : "anchor.html"
<html>
<head>
<title>Home</title>
</head>
<body>
<a href="welcome.html"> Click Here</a>
</body>
</html>


Example :  "welcome.html"
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1>Welcome to HTML</h1>
</body>
</html>

Output:
anchor
welcome

Next Topic :Marquee Tag in HTML