我有这个 175x175 的背景图像,但我正试图用它制作一个“CD”封面。在下面的代码中(jsFiddle 可用),您会看到它没有调整大小,而只是“裁剪”。我该如何解决?
HTML:
<div class="cd"><div class="hole"></div></div>
<p>I want the image above to be resized to 75x75... but it's not</p>
<img src="http://userserve-ak.last.fm/serve/126/23679395.jpg" alt="Test" />
<p>Actual image size above.</p>
CSS:
.cd {
-moz-border-radius: 63px;
-webkit-border-radius: 63px;
border-radius: 63px;
background-image: url('http://userserve-ak.last.fm/serve/126/23679395.jpg');
width: 75px;
height: 75px;
position: relative;
border:1px solid #A1A1A1;
}
.cd .hole {
width: 20px;
height: 20px;
position: absolute;
background-color: #ddd;
border:1px solid #A1A1A1;
left: 28px;
top: 28px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
}