HTML

Joe Bergin
Joe Bergin
1,271 Points

Image Map - Wordpress - Not Working

Hello,

I'm desperately trying to map links on an image using the code editor on a Wordpress Website. I'm using the below code with no luck (I've obviously removed my hyperlinks, title and alt text). The image itself loads on the preview page but my links just won't work. Can anyone please help.

<img src="EXAMPLE-IMAGE" usemap="#image-map">

<map name="image-map">
    <area target="" alt="" title="" href="" coords="2044,408" shape="rect">
    <area target="" alt="" title="" href="" coords="1948,913" shape="rect">
    <area target="" alt="" title="" href="" coords="1771,1017" shape="rect">
    <area target="" alt="" title="" href="" coords="1623,738" shape="rect">
    <area target="" alt="" title="" href="" coords="1450,958" shape="rect">
    <area target="" alt="" title="" href="" coords="983,660" shape="rect">
    <area target="" alt="" title="" href="" coords="566,667" shape="rect">
    <area target="" alt="" title="" href="" coords="336,449" shape="rect">
    <area target="" alt="" title="" href="" coords="230,517" shape="rect">
    <area target="" alt="" title="" href="" coords="390,310" shape="rect">
</map>

Link to image I'm trying to map. https://imgur.com/Q4lDndL

1 Answer

Cameron Childres
Cameron Childres
5,084 Points

Hi Joe,

To define a rectangle in an image map I believe you need two pairs of numbers. The first pair specifies where to start the top-left corner of the rectangle and the second pair determines where it ends on the bottom-right. With just a single set of x-y coordinates there's no way the browser will know what size rectangle you're going for. Try something like this:

<map name="image-map">
    <area target="" alt="" title="" href="" coords="2044, 408, 2088, 452" shape="rect">    
</map>