sound advice, your web design resource logo Home exchange links about us anti-spam pevention our web hosting company
 
search our websitesearch the internet

Tell a friend:

Index: Website Creation

Contains HTML tips, guides to forms, CSS, Java, forms, CGI, image tools, image galleries, website management tools and more!


Resource Guide To - Website Development & Design

Index 3:  Creating Tables - Everything About HTML Tables

 

Title Your Tags using HTML 4.0

Using HTML4's TITLE attribute to create interactive tags.

The <A> tag has two well-known attributes: HREF and NAME. We will take a look at the TITLE attribute, and see what effect it has on the <A> tag.

Expanded Role Play For Titles

Prior to HTML 4.0, the TITLE attribute was defined only for a handful of tags, including the <A> tag. In the case of the <A> tag, the attribute was intended to provide a title for the object referenced by the link. By adding the TITLE attribute, the browser would have something to use as a document title if the object, especially non-HTML objects, did not have a title. How the browser used this title was not defined; it might stick it in the title bar of the window displaying the object or use it in your bookmark file when saving the link to the object.

The good news is that HTML 4.0 has changed all of this. In HTML 4.0, the TITLE attribute can be used with almost any tag, and it is intended to provide descriptive information for the contents of the tag. Again, how the browser uses this information is not defined, but the HTML specification implies a much broader range of usage, including window dressings, pop-up "tool tip" windows, and audio feedback for visually-impaired users.

Browser differences

Before we show you how to add the TITLE attribute to your tags, we first need to cover the way they are viewed by the browsers. As with most things on the Web, Netscape and Microsoft chose to implement the TITLE attribute differently.

For Netscape, the handling of titles is consistent, if disappointing: The browser ignores them. Although HTML 4.0 offers strong hints about how titles might be used by a browser, they fell on deaf ears at Netscape. The browser doesn't complain about any titles you might add to a tag, but otherwise it leaves them alone.

Internet Explorer behaves more in line with the HTML 4.0 standard. It displays the title of any element in a tool-tip box when the mouse passes over the element. This is true regardless of the element type. To see this behavior, move your mouse over the links at the beginning of the document, and see what you find when you pass it over the section headers. Of course, you'll need to be running IE4 for this to work.

Using titles

Adding a title to the <A> tag is easy. If your title contains spaces, it's a good idea to enclose the value in quotes, like so:

  <A HREF="finalhost" TITLE="Link to packages">

When the browser processes the tag, it associates the title with the contents of the tag.

There is no rule that says you must use the TITLE attribute with the HREF attribute. You can use it with NAME, or even by itself, with no other attributes in the <A> tag.

Since HTML 4.0 expands the role of the TITLE attribute to any tag, you don't even have to use the attribute with the <A> tag. Add titles to your paragraphs, headers, images, and most any other document element.

Keep in mind that the TITLE attribute is different from the <TITLE> tag. The former associates a title with an element within a document; the latter defines a title for the document itself.

<< BACK


 
© Copyright FinalHost.com -all rights reserved