问题:html文件中<body></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; width:100%; height:100%; z-index:-1">
<img src="pictures/background.jpg" height="100%" width="100%"/>
</div>
</body>
</html>
细节:../ 表示的是返回上一级目录访问 ;picture/ 表示访问的是同级目录中的picture