方式一:
<html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> html{ height: 100%; } body{ padding: 0; margin: 0; background: url("http://tpc.googlesyndication.com/daca_images/simgad/1628755112086520131") no-repeat; background-size: 100% 100%; position: absolute; } </style> </head> <body> </body> </html>
方式2:
<html>
<head>
<title>自适应</title>
<meta charset="utf-8" />
<style type="text/css">
html{
height: 100%;
}
body{
padding: 0;
margin: 0;
background: url("images/bg.jpg") no-repeat;
background-size: 100%;
position: absolute;
}
</style>
</head>
<body>
111
</body>
</html>