Don't know if CSS can do this ...

liunx

Guest
Hi!

Is it possible to have a specific words on an html page (for example: Web Developer) and when a visitor roll on this word, an alt tag message appear saying like "Forum for Programming..." just like an alt tag for an image ????The code below has the same result, but no CSS is involved.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>
<body>
<p><a title="Forum for Webdevelopers">Webdevelopers' Forum</a></p>
</body>
</html>

I highly doubt that there is a CSS solution for this problem. If it does exist, it would involve CSS generated content, which no browsers support anyhow. Using the <a> tag with the title attribtue, but no href attribute, is the easiest answer right now.

My question is, though, why would you need non-linked text to have a title or description? It's plain text whose meaning should be explained by the surrounding words.Look down this page (<!-- m --><a class="postlink" href="http://www.alistapart.com/articles/practicalcss/">http://www.alistapart.com/articles/practicalcss/</a><!-- m -->) for the CSS Help section. I think that's what you're talking about.That is similar to what turb wants. What he would like is:

<style type="text/css">
<!--
div "web developer forums" {
tool-tip: "Forums for web developers covering all major web programming languages.";
-->
</style>
<head>
<body>
.
.
.
<div id="anyID">
<p>This is some body text found at various web developer forums.</p>
</div>
}

In the hypothetical situation above, he would like any instance of "web developer forums" located in a DIV tag to automatically have the title text without having to change the markup (I assume this is the general idea). The example above does not work, by the way. I was-a makin' up CSS :)

But the answer to turb's question is exactly like ray326 suggested. Encapsulate the words in a <span> tag and include the title attribute with the text you want to display in the tool tip.

There is no "purely CSS" solution to the problem.
 
Back
Top