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
HTML Links
HTML Images
Exercises & Assignments
Write an HTML program to create links (new tab and email)
Write an HTML program to display an image
Interview Questions & Answers
How do you create links to sections within the same page?
What do you mean by HTML links?
How to create a link to jump to a specific part of a page in HTML?
How do you insert an image into HTML?
What is the alt attribute in HTML and why is it important?
How to open a link in a new tab in HTML?
What is the difference between absolute and relative URL in HTML?