您必须使用SVG。 使用svg以外的任何东西来使图像的某些部分可点击是不明智的。
[https://www.w3schools.com/graphics/svg_intro.asp]
您可以将所有图像添加到容器div中,然后使用css:
HTML
<div class="container">
<img class="image_1" /> // the background
<img class="image_2" /> // the clickable square
</div>
CSS
.container {
position: relative;
}
.image_2 {
position: absolute;
left: 50px;
top: 50px;
}