-4

I have a png image, it's a map, it represents 4 countries : france, italy, spain and germany, what I need to do, is to use CSS to devided and by passing cursor on each zone, i'll have a popup with name of every country.

Div doesn't need to be with exact shapes of every country.

Any idea how to put div for each zone inside this image please ?

For now i'm trying this :

container{
   width : 100px;
   height : 100px;
   overflow : hidden;
}

and the HTML is :

<div class = "container"><img src="src/assets/img_map.png"/></div>
Alfin Paul
  • 1,543
  • 14
  • 26
Sushi
  • 646
  • 1
  • 13
  • 31

2 Answers2

2

Create hotspot/imagemap on image

An imagemap is a graphic image where a user can click on different parts of the image and be directed to different destinations. imagemaps are made by defining each of the hot areas in terms of their x and y coordinates (relative to the top left hand corner). With each set of coordinates, you specify a link that users will be directed to when they click within the area.

Image map generator link

Alfin Paul
  • 1,543
  • 14
  • 26
1

Use an imagemap (html Elements map and area) and do the necessary highlighting via JavaScript.

Or do a position: relative on your container and add your divs with position: absolute inside the container.

Björn Tantau
  • 1,564
  • 14
  • 13