views:

1032

answers:

3

Hi,

Iam new to CSS and Javascript. In my website I have an image as the navigation bar and have created hotspots to link them to different pages. The problem is since the text is a part of the image, I cannot change the style of the text on hover. Whereas I want the text/the hotspot to stand out on mouseover, so I learn the background color could be changed on mouse over. Is that possible? Is there a way to do that in CSS, using the area or maps. If Javascript is to be used, could someone help me out with it.

Thanks and Regards, Ron

+3  A: 

Is there a reason you've used a single image as the nav bar?

Instead of a single image with hotspots, I'd use an individual image for each navigation link. That way you can easily change the image (or use CSS image positioning) on hover. This is described here:

http://css-tricks.com/video-screencasts/7-three-state-menu/

along with many other places I'm sure.

Mike Edwards
+2  A: 

I don't think it's a good idea to use neither image maps nor individual images.

Instead, use CSS sprites: a single image file, add that as a background image to the menu links, but position the background images differently. See this Line 25 tutorial for more information.

Jacob R
That's what I meant by CSS image positioning, just didn't use the proper terminology, sorry.
Mike Edwards
Oh hold on, it's not quite the same. The technique is similar but has an individual image for each menu selection, containing the two versions of the image and three positions. Yours uses one image and alters horiz and vert offset. Must read on this some more.
Mike Edwards
A: 

There is a nifty JavaScript called mapper.js which is available here. It will allow you to highlight the hotspot upon mouse over. Not sure what else it does or how it may help you but its worth checking out.

Salman A