Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-03-2007, 12:23 PM   PM User | #1
twomt
New Coder

 
Join Date: Sep 2006
Posts: 92
Thanks: 4
Thanked 1 Time in 1 Post
twomt is an unknown quantity at this point
<map> ... </map>

Hello,

I have a <div> with a background image on which i would like to use the <map></map> tags to set a link at a certain spot.

Now I can do the map function on an image that is shown after the map has been declared with the usemap attribute, but is there a way to do this on a div as well or do I have other means to set links at certain spots of a background image?
twomt is offline   Reply With Quote
Old 06-03-2007, 12:35 PM   PM User | #2
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,892
Thanks: 5
Thanked 187 Times in 184 Posts
Arbitrator is on a distinguished road
You can do this (without the map element), but it depends on whether or not the selectable region is rectangular.

Edit: The selectable region must be rectangular. However, now that I think about it, I would recommend against using the technique since it would result in duplicated content and decrease accessibility.

Code:
<div><a href="/"><img alt="…" width="…" height="…" src="…"></a></div>
In the above code, the image element would be completely transparent (or a repeat of the content underneath). The anchor element would be positioned over the “selectable” area of the background and the image within would be styled such that its width and height are of the same dimensions as this selectable area. With this, you would have a fall‐back in case (A) the images fail to load and (B) in case CSS is disabled. The fall‐back in the case of (B) would be pretty poor though since you couldn’t see anything unless you used the mentioned repeat of content. In the case of (A), if the anchor image failed to load but the background image did not, you would end up with duplicate text over the background image. If the reverse happened and the anchor image loaded, but the background image did not, then you would have an invisible link unless you used the mentioned repeat of content. (A) would, however, work fine if both images failed to load.
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *

Last edited by Arbitrator; 06-03-2007 at 01:00 PM.. Reason: I described the technique that I was referencing.
Arbitrator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 PM.


Advertisement
Log in to turn off these ads.