日期:2014-05-17  浏览次数:20493 次

一个图片位置问题
我想在一个小方框里显示一幅图像的左边的中间部分,像这样
<div   style= "overflow:hidden;   height:500px;   width:300px; ">
<img   src= "***.jpg "   style= "position:absolute;top:-200px; "/>
</div>
关键问题是,那个height:500px;   width:300px的小方框被图片撑大,无视overflow:hidden;的限制。假如没有position:absolute;这句话,小方框
显示正常,但是只显示图片的左上角,top:-200px没有起到作用。各位高手
有没有什么办法?
不能用 <div   style "background:url()   top: "> </div> 这种形式

------解决方案--------------------
<div style= "overflow:hidden; height:500px; width:300px;position:relative ">
<img src= "***.jpg " style= "position:absolute;top:-200px; "/>
</div>
位置按图片调整吧,应该可以~
------解决方案--------------------
<div style= "overflow:hidden; height:500px; width:300px; background:url(bj003_chinami133.jpg) center left; " > </div>

左边的中间部分