HTML and CSS Reference
4. Save your changes to the file.
5. Refresh the tips.htm file in your browser. Click each of the four links to external
Web sites and verify that each opens in the same new browser window or tab.
6. Close the secondary browser window or tab.
You should use the target attribute sparingly in your Web site. Creating second-
ary windows can clutter up a user's desktop. Also, because the page is placed in a new
window, users cannot use the Back button to return to the previous page in that window;
they must click the browser's program button or the tab for the original Web site. This
confuses some users and annoys others. Many Web designers now advocate not using
the target attribute at all, leaving the choice of opening a link in a new tab or window to
users. Note that the target attribute is not supported in strict XHTML-compliant code.
To force all hypertext
links in your page to open
in the same target, add
the target attribute to a
base element located in
the document's header.
Creating a Tooltip
If you want to provide additional information about a link on your Web page, you can
add a tooltip to the link. A tooltip is descriptive text that appears when a user positions
the mouse pointer over a link. Figure 2-45 shows an example of a tooltip applied to one
of Gerry's links.
Viewing a tooltip
To create the tooltip, add the title attribute to the opening <a> tag in the form
<a href=” url ” title=” text ”> content </a>
where text is the text that appears in the tooltip. To create the tooltip shown in
Figure 2-45, you would enter the following HTML code:
title=”View Weekly Tips from CAMshots”>
Tooltips can also be added to image map hotspots to provide more useful feedback to