Write an HTML program to create links (new tab and email)

Description: Create a web page with a link that opens a website in a new tab, a link to another page of your site, and a link to send an email.

Hint:

  • Use the <a> tag with href.
  • Use target="_blank" for a new tab and mailto: for an email link.

HTML program to create links

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Links</title>
</head>
<body>
  <p><a href="https://www.example.com" target="_blank" rel="noopener">Visit Example (new tab)</a></p>
  <p><a href="about.html">About us</a></p>
  <p><a href="mailto:info@example.com">Send an email</a></p>
</body>
</html>

Output in the browser:

How it works

  • target="_blank" opens the link in a new tab, and rel="noopener" keeps it safe.
  • about.html is a relative link to a file in the same folder.
  • mailto: opens the email app of the visitor.

Read HTML Links.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.