这几天在做一个小页面,需要放背景图片,body的css样式如下:


body{
    margin: 0px;
    padding: 0px;
    width:100%;
    height: 100%;
    opacity: 0.4;
    background: url(images/register_back.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    }

设置了背景图片和不重复,尺寸也设置了100%,但是在这种情况下,安卓和苹果手机都没有铺满全屏,对了这个背景图的分辨率是750*1206 

ios下:

html 学习之 背景图不撑开的问题


下方有一大空白区域


android手机:

html 学习之 背景图不撑开的问题


下面也有一大段空白,

如果再加一句:background-attachment: fixed; 后,ios 的可以铺满,但是android的还是铺不满,需要把background-size: 100% 100%; 改为

background-size: cover; 之后ios和android都会铺满



 

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-12-22
  • 2022-12-23
猜你喜欢
  • 2022-01-23
  • 2021-09-28
  • 2022-12-23
  • 2021-12-19
  • 2021-12-04
  • 2021-09-19
相关资源
相似解决方案