I want to make an interactive map of the world using HTML, CSS, and JS. Using SVG was probably the recommended way to go, but to be honest I have no experience in utilizing it. Plus editing paths for doing minor changes is a pain. I really prefer exporting each country as a PNG image, placing them in HTML, and JS will handle all the interaction.
It's really easy in concept. The problem however is that how to layer these different PNGs so that each countries will be on its specific place? If you use two <img src=... it would either put the images into a column or a row:
This is how it should be

But this is how it will show up in HTML

or this

Forgive me for being too naive of this. Thanks a ton!
For this case, I would use position:absolute on the images, and use the left, right, top, bottom properties to align them how you like. Just be sure to set position:relative to your parent div.
If this is not possible for whatever reason, you can use the transform property to set the horizontal and vertical position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With