发布网友
共1个回答
热心网友
html网页设计里面平铺背景图片的代码如下:
<html>
<body>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:100%; height:100%">
<img src="pictures/background.jpg" width="100%" height="100%"/>
</div>
</body>
</html>
网页背景默认是平铺整个屏幕的,可能有以下原因导致不能平铺:
1、图片不够大,又background属性不能拉伸图片;
2、只能用个div,把其z-index值设为负,并使这个div大小为整个body大小,在div里用<img> ;
3、body的background属性去掉,要不然会被遮住。