方法一、background背景图片设置
html,
body {
width: 100%;
height: 100%;
background: url(../images/bg.png) no-repeat;
background-size: 100% 100%;
background-attachment: fixed;/* 不设置的话页面滑动时,背景会不铺满*/
}
方法二、图片绝对定位实现
<body>
<div id="Layer1" style="position:absolute; width:100%; height:100%; z-index:-1">
<img src="images/bg.png" height="100%" width="100%" />
</div>
</body>
原文链接:https://blog.csdn.net/qq_36699230/article/details/104051318
怎么让背景图片铺满整个页面
最新推荐文章于 2023-11-28 11:56:00 发布