Solved

image map for background image in a div tag

Posted on 2007-11-23
7
6,552 Views
Last Modified: 2013-11-19
Hi

Can someone please tell me how I can create some maps for an image thats the background of a div tag.
<div id="maindiv" style="border: 1px solid blue; background-image: url(background800600full.gif); width: 800px; background-repeat: repeat-x;" align="center">
I'd like to create maps for 3 segments of the image.  Im a novice to maps, divs etc and the tutorials online dont have exactly what I'm looking for
Also I have just noticed that on my local browser the image appears but when I upload to my webserver it doesnt appear unless I do a direct insert ie <IMG>

Much appreciated
Louise
0
Comment
Question by:louise_8
  • 3
  • 2
7 Comments
 
LVL 18

Accepted Solution

by:
Eternal_Student earned 200 total points
ID: 20338400
Firstly, you cannot put an image map on a background image but you CAN lay a transparent gif on top of that:

http://www.recentrambles.com/pragmatic/view/35

Not sure what you are trying to achieve, but it sounds like that could be a solution ^.

The second issue is probably to do with the path to your image. If you are using an external style sheet then the link will probably have a different path than when you enter it into the html page. Depends on how your site is structured of course.
0
 

Author Comment

by:louise_8
ID: 20338591
Thanks Eternal Student, love the name :)
Im not using an external style sheet for my div just this code; background-image: url(background800600full.gif);  with background800600full.gif being stored in the same folder, does that indicate what Im doing wrong?

I will implement the other code for the map as soon as I get the above working and let you know

Cheers
0
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 20338802
Put the background style in the css at the top:

<style type="text/css">
#divname{background-image: url(background800600full.gif);}
</style>

Providing the image is uploaded and in the same directory as this page then it should load. You will also need to give the div the correct id. If this doesnt work then send me a link and I will be able to work out why.


0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:louise_8
ID: 20347551
Thanks, heres the link http://www.resource-central.org/louise/louiseg.html if i just include the background image in the css code it wont work locally.  Ive left both in, you'll probably figure it out straight away :)
0
 
LVL 3

Expert Comment

by:anandhariharan
ID: 20497784
Try this! This sure should solve your problem
<div id="maindiv" style="border: 1px solid blue; background-image: url(background800600full.gif); width: 800px; background-repeat: repeat-x;" align="center">
<a href="something.htm" style="display:block; width:800px; height:100px;">&nbsp;</a>
</div>

Open in new window

0
 

Author Comment

by:louise_8
ID: 20678736
apologies for the delay getting back on this.  I thought I had accepted this, perhaps the page crashed.. and only noticed when I logged back in today after 6 weeks- I have been away.  
Thanks Eternal student for your help and anyone else that contributed
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question