Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ img area coords as percentages

Posted by: alancunn Apr 30 2007, 07:43 AM

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!

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>A test of image maps</title>
    </head>
    <body>
        <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="http://www.htmlhelp.com" alt="A nice link"/>
        </map>
    </body>
</html>


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

Posted by: Tom H. May 1 2007, 03:28 PM

It seems to work as expected in Safari but no other browsers which I've tried.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)