HTML Tutorials

Customizing Links

You can customize links to:

✓ Open linked documents in new windows

✓ Link to specific locations within a web page of your own

✓ Link to items other than HTML pages, such as

  • Portable Document Format (PDF) files
  • Compressed files
  • Word processing documents

Opening new windows

The web works because you can link pages on your website to pages on other people’s websites by using a simple anchor element. When you link to someone else’s site, though, you send users away from your own site. To keep users on your site, HTML can open the linked page in a new window or in a new tab inside the same browser window. The simple addition of the target attribute to an anchor element opens that link in a new browser window (or tab) instead of opening it in the current window:

<p>The <a href="" target="_blank">World Wide Web Consortium</a> is the standards body that oversees the ongoing development of the XHTML specification.</p>

When you give a target attribute a _blank value, this tells the browser to do the following:

1. Keep the linking page open in the current window.

2. Open the linked page in a new window or tab.