Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn US Map into State Links

Tags:

html

css

I may have done something dumb - I quickly promised a client I could turn their US Map image into individual state links - but now that I'm thinking about it, even if I do each state as an image, the images will be square, meaning there will be empty space at the edge of each image that will overlap other states, making it so the links overlap. Is there a better way to do this, or any way at all?

like image 790
Molly Campbell Avatar asked Jan 29 '26 21:01

Molly Campbell


1 Answers

The links in client-side imagemaps don't have to be rectangles; they can be arbitrary polygons. So you can make each state clickable without overlapping, and get as close as you want to its "real" borders (depending how high-res your overall map image is).

Defining these polygons pixel-by-pixel is obviously tedious, so most people use programs that build the HTML code for you. Google "imagemap editor" for one that works on your OS (you don't say if you're using a Mac or PC). Here's one that says it comes with a USA map already defined!

like image 144
dodgethesteamroller Avatar answered Feb 01 '26 13:02

dodgethesteamroller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!