Help - Search - Members - Calendar
Full Version: img area coords as percentages
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Hi all,

I have been trying to get the well known client side image maps working. I would really like to use percentages (all the co-ordinates will be generated by PHP so the difficultly with values vs percentages doesn't exist!). However, I can not get percentages to work - browsers just appear to ignore the percentage sign.

Am I missing something or is this another very useful item that browsers will just not bother with?

The reason for using percentages is so that I can make the img 100% width of container and the image map still works - by the specifications this should be possible but I can't get it to work.

Here's some code to show!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">
        <title>A test of image maps</title>
        <img src="test.bmp" usemap="#mymap" height="400" width="200" alt="test image"/>
        <map name="mymap" id="mymap">
            <area shape="rect" coords="0,0, 50%, 50%" href="" alt="A nice link"/>

test.bmp is any image, and the top left quarter of the image should be a link to this site (just for demonstration purposes wink.gif )

Thanks in advance,

Alan unsure.gif
Tom H.
It seems to work as expected in Safari but no other browsers which I've tried.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.