图片自适应完美兼容IE8

时间:2022-03-17 17:10:52

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="gb2312">
<title>用户注册</title>
<style>
body, html {
padding:0px; margin:0px;
}
</style>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<div id="formbackground" style="position: absolute; z-index: -1;">
<img src="Login-bg.jpg" height="100%" width="100%" />
</div>
<div style="height:2000px;">
adf
</div>
<script type="text/javascript">
$(function () {
$('#formbackground').height($(document).height());
$('#formbackground').width($(document).width());
});
</script>
</body>
</html>