Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Voices That Matter

  • Print
  • + Share This
This chapter is from the book

Labeling Elements in a Web Page

You can use the title attribute to add a tool tip label to practically every part of your Web site. It's particularly helpful for giving your visitors clues about what's needed in form elements, but you can use it to label just about anything.

To label elements in a Web page

In the (X)HTML tag for the item you want to label, add title="label", where label is the text that should appear in the tool tip when a visitor points at the element.

Example 3.23. You can add a title to any element you wish.

<body>

<!--Here is the table of contents, which in a real
document might be a good deal longer.-->

<div id="toc" title="Table of Contents">Antoni
Gaudí<br />La Casa Milà<br />La Sagrada
Família</div>

<div id="gaudi">

<h1>Antoni Gaudí</h1>

<p>Many tourists are drawn to Barcelona to see
Antoni Gaudí's incredible architecture. </p>

<p>Barcelona celebrates the 150th anniversary of
Gaudí's birth in 2002.</p>


<div class="works">

<h2>La Casa Milà</h2>

<p>Gaudí's work was essentially useful. La Casa
Milà is an apartment building and <span
class="emph">real people</span> live there.</p>

</div>


<div class="works">

<h2>La Sagrada Família</h2>

<p>The complicatedly named and curiously
unfinished Expiatory Temple of the Sacred Family is
the <span class="emph">most visited</span>
building in Barcelona. </p>
title_netmac.jpg

Figure 3.24 When your visitors point at the labeled element, the title will appear.

  • + Share This
  • 🔖 Save To Your Account