Computer >> Computer tutorials >  >> Programming >> HTML

How to use href attribute in HTML Page?


The href attribute in an HTML page is used to specify the URL for a page. If the href attribute is not present, then the <a> tag will not be considered as a hyperlink.

Just keep in mind the href attribute should get included as an attribute for <a> tag. It should be used inside the <body>…</body> tags.

How to use href attribute in HTML Page?

Example

You can try the following code to make page links in an HTML page using the href attribute

<!DOCTYPE html>
<html>
   <head>
      <title>HTML href attribute</title>
   </head>

   <body>
      <h1>Learn about the company</h1>
      <a href="/about/index.htm">About</a>
      <a href="/about/about_team.htm">Team</a>
   </body>
</html>

Output

How to use href attribute in HTML Page?