How do I code a image map using CSS Style sheet?

Associate
Joined
1 Aug 2007
Posts
1,065
Hi gents,

Trying to put together a basic website and I need to use a image map but as I insert my picture using the style sheet I cannot get the below code to work.

Can I put this code in the css?

Code is.

Code:
<IMG SRC = "nav.gif" USEMAP = "#1" BORDER = "0">
<MAP NAME = "1">
<AREA SHAPE = "RECT" COORDS = " 589,  8,  604,  22" HREF = "http://delicious.com/">
<AREA SHAPE = "DEFAULT" NOHREF>
</MAP>

but I already have the image on the website using my css.

Code:
#navigation ul.nav {
	background: url(images/nav.gif) no-repeat;
	height: 24px;
	padding-left: 40px;
	padding-top: 7px;
}
 
1. Why would you use an image map on a navigation list? Kind of defeats the point of having a list.
2. Pretty sure you would need to use an actual image, not one dropped in with css.
3. Why do you have so many spaces in your html? They're not needed and make it difficult to read.
4. No, you cannot insert that into CSS, it's HTML.
5. The reason it's probably not working is that your html says the image is in the same directory as the html file but your CSS says it's elsewhere. I see no other reason why your code won't work. Put it online and I'm sure someone will take a look at it.
 
I decided to do as you suggested and no longer need to use the image map solution. The code had spaces because it was generated like that using a image map program.

Thanks
 
Back
Top Bottom