为什么不显示整个原始图片?div中的图片不会显示
<div class="test"></div>
.test {
background: url("http://i27.tinypic.com/28ktoh.jpg") no-repeat;
}
问题是犯规显示任何东西,如果你输入在div东西它显示的图像的一点点。我希望它包含完整的图片。
(在CSS复制粘贴的链接,查看完整图片)
为什么不显示整个原始图片?div中的图片不会显示
<div class="test"></div>
.test {
background: url("http://i27.tinypic.com/28ktoh.jpg") no-repeat;
}
问题是犯规显示任何东西,如果你输入在div东西它显示的图像的一点点。我希望它包含完整的图片。
(在CSS复制粘贴的链接,查看完整图片)
设置div
的高度。 div
不会比你说的要高或超过它的值。
您需要确实指定height
.test {
background: url("http://i27.tinypic.com/28ktoh.jpg") no-repeat;
overflow:auto;
height:500px;
}
不需要指定宽度吗? – pixeltocode 2010-07-28 12:33:21
@pixeltocode:这取决于OP。我只是向他展示了他做错了什么。 – Sarfraz 2010-07-28 12:40:59
。你可以补充一点,如果他想显示整个图像,他可能会更好使用''(如果适用)? – MvanGeest 2010-07-28 11:50:57
@MvanGeest:他用它作为背景图片,所以我不确定这是否合适。 – 2010-07-28 11:52:59
他是,但也许他不应该...... – MvanGeest 2010-07-28 11:53:29