Linktext… The Chinese translation of Example is: Example The following is a sample program that uses relative URLs to link pages. Login page Linktext… The Chinese translation of Example is: Example The following is a sample program that uses relative URLs to link pages. Login page

Home >Web Front-end >HTML Tutorial >How to link pages in HTML using relative URLs?

How to link pages in HTML using relative URLs?

WBOY
WBOYforward
2023-09-14 13:09:02597browse

How to link pages in HTML using relative URLs?

In HTML, different HTML elements have attributes that point to other resources. The value of these properties is a URL, which can be absolute or relative.

Relative URLs do not contain the full URL. With relative URLs, we automatically start at the address where the browser is currently located and then add the path component and extension. Explicitly tell the browser to use the current folder.

grammar

The following is the syntax for linking pages using relative URLs.

<a href="relative URL">Link text…</a>
The Chinese translation of

Example

is:

Example

The following is a sample program that uses relative URLs to link pages.

log in page

<!DOCTYPE html>
<html>
<body>
   <h2>Relative link</h2>
   <h3>Sign In Page</h3>
   <form>
      <label for="fname">Email Address</label><br>
      <input type="text" id="fname" name="fname" ><br>
      <label for="lname">Password</label><br>
      <input type="text" id="lname" name="lname" ><br><br>
      <input type="submit" value="Login"> <a href="Untitled-2.html">Sign Up</a>
   </form>
</body>
</html>

registration page

<!DOCTYPE html>
<html>
<body>
   <h2>Relative link</h2>
   <h3>Sign Up Page</h3>
   <form>
      <label for="fname">Name</label><br>
      <input type="text" id="fname" name="fname" ><br>
      <label for="email">Email</label><br>
      <input type="text" id="email" name="email" ><br>
      <label for="fname">Password</label><br>
      <input type="text" id="fname" name="fname" ><br>
      <label for="lname"> Re-enter Password</label><br>
      <input type="text" id="lname" name="lname" ><br><br>
      <input type="submit" value="Submit"> <a href="Untitled-1.html">Login</a>
   </form>
</body>
</html>

In the above example, we linked two different pages using relative URLs. Relative URLs do not contain the full URL. As we can see in the sample program above.

The above is the detailed content of How to link pages in HTML using relative URLs?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:HTML color stylesNext article:HTML color styles