Post by GeekGrannyPost by GeekGrannyPost by WinstonPost by Jen GailtI want to add a simple mouseover code to some stuff on my web page.
For example if they see the word: Mouse
it would have an underline, like it was a link, so people would put the
mouse over it, then text would pop up above their cursor, saying "Mouse
over code", explaining what it was.
Is it simple to do that?
Depending on exactly what effect you want and how widely /
* the HTML tags <abbr> and <acronym>
* the intrinsic events onmouseover / onmouseout (requires Javascript)
* the style sheet pseudo-class ":hover" (requires CSS).
I tried the acronym tag and it works. Thanks!
<acronym title="as soon as possible"><u>ASAP</u></acronym>
ACK! I take that back. I tried it and it worked in CoffeeCup HTML Editor
but NOT in Seamonkey after I uploaded it!
Don't be too surprised. Different browsers implemented different sets
of tags. That's one reason why you see web sites that say things like
"optimized for [some particular browser]". For example, Netscape 6
supported both <abbr> and <acronym>; MSIE for Mac supported <acronym> but
not <abbr>; and MSIE 6 for Microsoft Windows didn't support either.
Cascading Style Sheets, by comparison, are supported by pretty much all
the newer graphical browsers, and while implementations of that vary, too,
common things like the example below should work the same in all of them.
CSS has several ways of simulating <abbr>. This example uses a fixed
offset, and so doesn't work so well if the abbreviation is too close to the
edge of the screen, but may give you an idea of how style rules can be used
to create various effects:
----------
<head>
<style type="text/css"><!--
.abbrlabel { position:relative; display:inline }
.abbrlabel div { position:absolute; top:17px; display:none }
.abbrlabel:hover div { display:block }
--></style>
</head>
<body>
Here's an abbreviation:
<div class="abbrlabel">CONUS<div>Continental United States</div></div>.
</body>
----------
That technique may not work on tiny-screen cellphone browsers, browsers for
the blind, etc.
HTH,
-WBE