您的代码有两个主要问题。
第一个是您正在使用
background-size: 200px 258px;
。指定的长度值
background-size
将强制背景到这些维度。这会将412 x 260的图像压缩到200 x 258,这就是显示整个图像的原因。
<length>
A.
<长度>
将背景图像缩放到相应维度中指定长度的值。不允许负长度。
背景大小(
https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
)
第二个原因是您错误地指定了
width
在…上
a.rolla
,
a.rollb
,
a.rollc
和
a.rolld
.之间的空间
200
和
px
意味着它正在被忽略,并且正在增长到包含的宽度
td
(这反过来显示了比所需更多的背景)。
要修复,请进行以下更改:
-
改变
width: 200 px;
到
width: 200px;
在…上
a、 罗拉牌手表
,
a、 滚动
,
a、 滚动
和
a、 滚动
-
去除
背景大小:200px 258px;
从…起
a、 罗拉牌手表
,
a、 滚动
,
a、 滚动
和
a、 滚动
a,
img {
border: none;
outline: none;
}
a.rolla {
display: block;
width: 200px;
height: 258px;
text-decoration: none;
background: url("http://i.stack.imgur.com/RCPyD.png");
background-repeat: no-repeat
}
a.rollb {
display: block;
width: 200px;
height: 258px;
text-decoration: none;
background: url("http://i.stack.imgur.com/RCPyD.png");
background-repeat: no-repeat
}
a.rollc {
display: block;
width: 200px;
height: 258px;
text-decoration: none;
background: url("http://i.stack.imgur.com/RCPyD.png");
background-repeat: no-repeat
}
a.rolld {
display: block;
width: 200px;
height: 258px;
text-decoration: none;
background: url("http://i.stack.imgur.com/RCPyD.png");
background-repeat: no-repeat
}
a.rollover:hover,
a.rollover2:hover,
a.rollover3:hover {
background-position: -213px 0;
}
a.rolla:hover,
a.rollb:hover,
a.rollc:hover,
a.rolld:hover {
background-position: -210px 0;
}
.displace {
position: absolute;
left: -5000px;
}
body {
background: url("rpt.png");
background-repeat: repeat;
width: 1024px;
margin: 0;
z-index: -1;
}
#banner {
z-index: 0;
}
#feTable {
z-index: 1;
position: absolute;
left: 0;
}
<div width="1024px">
<table id="feTable" style="width:1024px; left:22px">
<tr>
<td align="center" width="200px">
<a target="_parent" href="" class="rollb"><span class="displace"></span></a>
</td>
<td align="center" width="200px">
<a target="_parent" href="" class="rolla"><span class="displace"></span></a>
</td>
<td align="center" width="200px">
<a target="_parent" href="" class="rollc"><span class="displace"></span></a>
</td>
<td align="center" width="200px">
<a target="_parent" href="" class="rolld"><span class="displace"></span></a>
</td>
</tr>
</table>
</div>