Archive for the 'attributes' Category

How to use the Title Attribute without a hyperlink

Many times you may want to use the Title Attribute without having to provide a hyperlink. All too often people will incorrectly use the <a></a> tags for hyperlinks and not put an actual link into a document just so they can get a Title Attribute to show up when someone hovers over the text.

<a href=”#”>visible text for hyperlink that goes no where</a>

<a href=”#” title=”The text that shows up when you hover over the visible text for hyperlink”>The visible text for hyperlink</a>

Live example of the wrong way The visible text for hyperlink

There are two tags specifically designed for use in these situations. Note their primary purpose is specific however their application is more appropriate than using an <a> </a> tag.

Abbreviation Tags

The Abbreviation tag is <abbr></abbr>. It works just like the <a> tag and so you can achieve the result above as follows:

<abbr title=”The text that shows up when you hover over the visible text for subject of abbr tag” >The visible text of Abbreviation tag</abbr>

The visible text of Abbreviation tag

Acronym Tags

The Acronym Tag is similar to the Abbreviation tag except for its suppose to be used with similes (just kidding with Acronyms). The tags are <acronym></acronym>. It works just like the <a> & <abbr> tags and so you can achieve the result above as follows:

<acronym title=”The text that shows up when you hover over the visible text for subject of acronym tag” >The visible text of acronym tag</acronym>

The visible text of acronym tag

For more information on Acronym and Abbreviation Tags, please visit this useful resource.

Technorati tags: , , ,