背景图height:100%显示

这段时间,写移动端页面,总是遇到背景图在不同的设备上的显示拉伸问题;

本来想写百分比,可是并没有显示,又不想media@ ,换一种思路用img写

群友提供了一个办

 html,body{height:100%;}  
*{padding: 0;margin:0;}
.index-all{ 100%;height:100%;background-size:contain; background: url(img/weihui-a.jpg)center center no-repeat;}
<body>
    <div class="index-all" id="navigation"></div>
</body>

确实管用!

但是在我这并没有鸟用!

<div class="setup-bg">
    <img class="setup-img" src="img/setup_bg.png"  width="100%" width="100%">
    sss
</div>
.setup .setup-bg{ position: relative;height: 100%;}
.setup .setup-img{ position: absolute;top: 0;left: 0;z-index: -999;}

最后解决了,目前还没发现什么问题

原文地址:https://www.cnblogs.com/pangzi666/p/5163373.html