我使用 div 制作了一个“图像映射”,其中包含一堆<a>
div。它工作正常,但现在我希望能够缩放它,以便它可以调整 div 的大小,但我<a>
将保持相对于 div 的相同位置。
<div class="container">
<a href="#a1" class="dot" style="top: 138px; left: 28px"></a>
<a href="#a18" class="dot" style="top: 45px; left: 261px"></a>
<a href="#a20" class="dot" style="top: 45px; left: 336px"></a>
和CSS
#kit .container {
position: relative;
margin: auto;
background-image: url(../img/9829-Kit.png);
background-repeat: no-repeat;
height: 670px;
width: 700px;
}
a.dot {
position: absolute;
display: block;
height: 33px;
width: 34px;
cursor: pointer;
background-position: 0px 0px;
background-image: url(../img/dots.png);
background-repeat: no-repeat;
}
a.dot:hover {
background-position: 0px -40px;
cursor: pointer;
}