找了好多资料好像都不适合自己需要,最后想到用js来调整图片以适合窗口的大小。
<div style="width:100%;height:100%;position:absolute;z-index:-1;top:0px; text-align:center; vertical-align:middle;">
<img id="bgImage" src="images/bgRight.jpg">
</div>
<img id="bgImage" src="images/bgRight.jpg">
</div>
js:
<script type="text/javascript" language="javascript">
Show();
function Show()
{
with(document.documentElement)
{
$("bgImage").style.width = (clientWidth-100 > clientHeight)?(clientWidth-100):clientWidth+"px";
$("bgImage").style.height = (clientHeight)+"px";
}
}
</script>
Show();
function Show()
{
with(document.documentElement)
{
$("bgImage").style.width = (clientWidth-100 > clientHeight)?(clientWidth-100):clientWidth+"px";
$("bgImage").style.height = (clientHeight)+"px";
}
}
</script>