On Sat, 9 Oct 2004 21:22:18 +0930, PhilM <ph***@nospam.com.am> wrote:
> Is it possible to emulate the <javascript>mouseover in css,
> to replace link images with an alternate?
a:link {background-image: url(foo)}
a:hover {background-image: url(bar)}
That hard?
no that way is not that hard, but, it still requires text. This only
alters
the background, not the foreground, which I am trying to do :(
If it's foreground, then it's content, and therefore not the role of CSS,
which is merely optional styling of content. HTML itself, of course,
cannot swap the images. The JS solution fails in non-Javascript
environments. And if the hover image tells the user what the link is, and
the normal image doesn't, well, that's mystery-meat design and not a good
choice beyond the technical considerations. We need something which is
either foolproof and will work or degrade well in all situations, or is
not foolproof but still cannot fail no matter what a browser does with it.
So, the only solution I see is to make sure the default image seen in
non-Javascript environments is effective alone, and users with Javascript
working will get the optional effect. (Perhaps, and I don't know enough
about it to say for certain, some server-side scripting might be able to
do this. I'd have no clue how to accomplish this, I'm simply acknowledging
that I cannot be definitive concerning this area.)
Incidentally, it very well may be that the design constraints under which
you're trying to solve this problem would make a viable solution
impossible. Be sure to consider that carefully.