Link Targets and titles - HTML

Link Targets
Normally, links open the page they refer to in the active browser window, replacing the page currently displayed. However, you can control where the page opens using the target attribute in the link tag.

Note: The target attribute has been deprecated in strict HTML. It appears here because most browsers still support the attribute and it can be useful. However, keep in mind that your documents will not validate against strict HTML if you use the target attribute.

Target Attribute Values

Target Attribute Values

Target Attribute Values

For example, to open a linked document in a new window you would use a tag:

Caution: The debate about whether you should ever open a new window is fierce. Most users are accustomed to all new windows being of the pop-up ad variety—and very unwelcome. However, from a user interface standpoint, new windows can be used very effectively if they are used like dialog boxes or new windows that an operating system spawns. In any case, you should make a habit of informing users when you are going to open a new window so you don’t surprise them.

The last value listed for target, name, can also aid in the user interface experience, if used correctly. Certain methods of opening windows (such as the JavaScript window.open method) allow you to give a browser window a unique name. You can then use that name to push a linked document into that window. For example, the following code displays two links; the first opens a new, empty browser window named NEWS, and the second pushes the content at www.yahoo.com into the window:

Link Titles

You can also title a link, using the title attribute in the anchor tag. This causes most current browsers to display the text of the title as a ToolTip when the mouse hovers over them. For example, the following link will cause Internet Explorer 6 to display.

More information can be found here</a>.

The title attribute causes a ToolTip display when the mouse hovers over the link.

The title attribute causes a ToolTip display when the mouse hovers over the link

You can use this feature to give the user more information on the link, before they click it.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

HTML Topics