html,body{
background:url(../img/bg.jpg) center center no-repeat;
}
经测试其他5.5寸以下的手机屏都能完整显示背景图
5.5的不行,页面底部会有30px的留白?
巴扎黑2017-04-17 13:46:12
html,body {
margin: 0;
padding: 0;
min-height: 100vh;
background-size: cover;
}
PHPz2017-04-17 13:46:12
background-size:cover;
The image itself is not wide and high enough. Using this parameter can make the image fill the screen, but the background will overflow the window
天蓬老师2017-04-17 13:46:12
When I was making a WEBAPP cover a long time ago, I thought @media all and (min-device-pixel-ratio: 16/9) {...} was good, but in the end I didn’t have the chance to use it. You can use multiple pictures and aspect ratios. It's just 16:9, 4:3, or the perverted Meizu 15:9, but I haven't tried it, sir. . .
天蓬老师2017-04-17 13:46:12
It is recommended to learn about the background-size attribute, https://segmentfault.com/a/11..., this is my explanation of this attribute, you can take a look, haha