微信小程序中背景图片如何占满整个屏幕,拉伸

图片说明图片说明

.backg{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:url('https://dfsn.china-tengyun.com/group1/M00/01/60/cH5Z71tsCSyAbaJdAACoXp7ghWs919.jpg') no-repeat #000;
background-size:cover;
z-index:-1;
}

width:100vw;
height:100vh

你选的模拟器是6plus,宽度不是750,可以改成100%,宽度撑满。就不会有横向间距了

 感谢  回答这么多问题就耍赖把我的积分一笔勾销了  的回答    解决了我的问题     我用的是min-height: 100%;

 <div class="bg-box">
    <img src="http://www.abc.com/i.jpg">
</div>

.bg-box{
    position: relative;
    width : 100%;
    height : auto;
    box-sizing: border-box;
}

.bg-box img{
    display:block;
    max-width: 100%;
}

将body和html设置为100%,这样我们就可以在他们的子元素中使用height:100%来使的我们的容器元素占满屏幕的高度啦。
但是在微信小程序中,是没有dom对象的,根节点是page,使用page{height:100%}
,高度占满了整个小程序的窗口。