css -- 背景图片自适应屏幕大小

 由于<body>标签的图片不能够拉伸,

解决办法:

1、图片不够大,又background属性不能拉伸图片;

2、只能用个div,把其z-index值设为负,并使这个div大小为整个body大小,在div里用<img> 3、body的background属性去掉,要不然会被遮住

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
<title>hello world</title>  
</head>  
<body>  
<div id="Layer1" style="position:absolute; 100%; height:100%; z-index:-1">  
<img src="pictures/background.jpg" height="100%" width="100%"/>  
</div>  
</body>  
</html>  
原文地址:https://www.cnblogs.com/hf8051/p/4428716.html