How to link pages using relative URL in HTML?

HTMLWeb DevelopmentFront End Technology

To link pages using relative URL in HTML, use the <a> tag with href attribute. Relative URL is used to add a link to a page on the website. For example, /contact, /about_team, etc.

Everything inside <a>…</a> tag becomes a hyperlink. Some of the attributes of <a> tag are listed below,

Sr.No.Attribute & Description
1Href
Specifies the URL
2Rel
Specifies the connection between current and linked document. Values can be nofollow, external, author, bookmark, etc.
3Target
Specify where the link will open. Values include _self, _parent, _self, etc

Example

You can try to run the following code to link pages using relative URL in HTML

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Relative URLs</title>
   </head>
   <body>
     <p>
        Our <a href="/about/about_team.htm">Team</a> comprises of programmers,
           writers, and analysts.
     </p>
   </body>
</html>
raja
Published on 01-Feb-2018 10:39:27
Advertisements