0
我目前使用一些代码来显示图片的'缩放填充'类型的方式。我正在使用的代码曾用于一个项目,我曾经为一个网站创建背景图片,现在我想将定位从固定位置更改为允许滚动。不过,我无法确定利润率和规模。CSS - 从固定位置改变位置以允许滚动
下面是代码:
<div id="Main Page">
<div id="Background">
<img src="http://googledrive.com/host/0By-qb7dZ_m5feE94MkcwSWxLckU" />
<style>
#Background{
position: fixed;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
}
#Background img{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50%;
min-height: 50%;
}
</style>
</div>
当你改变'fixed'到'absolute'什么不顺心? –
@ToniLeigh下面显示的div不能正确显示...... – dwinnbrown