苹果手机的z-index 无效的问题

今天在写一个H5页面的时候,发现一个问题在这里记录一下。

问题:如果css样式中 对一个元素 添加z-index: -1; 时 在android手机中正常,但是在苹果手机中 如果z-index的值为负数时,该元素就不会加载出来了


将z-index 设置为正数时,苹果手机也就正常了,下面贴上代码:


<div class="twoPerson">
							<img class="girl" src="images/cover/育儿测试封面_0000_背景-副本.png" />
							<img class="boy" src="images/cover/育儿测试封面_0001_背景-副本.png" />
						</div>
						<div class="divBottom">
							
						</div>

.twoPerson{
	position: absolute;
	bottom: 0px;
	height: 40%;
	width: 100%;
	z-index: 33;
	padding-bottom: 0px;
}
.twoPerson .girl{
	position: absolute;
	bottom: 0px;
	left: 0px;
	width: 55%;
	height: 95%;
	margin-bottom: 0px;
}
.twoPerson .boy{
	position: absolute;
	bottom: 0px;
	right: 0px;
	width: 44%;
	height: 50%;
	margin-bottom: 0px;
}

.divBottom{
	width: 100%;
	height: 7.5%;
	position: absolute;
	bottom: 0px;
	background-image: url(../images/cover/育儿测试封面_0008_Fh3BNZOuz9L2_Ju2qKzLfYK3jDUb.png);
	background-size: 100% 100%;
	-moz-background-size: 100% 100%;
	z-index: -1;
}
上述的.divBottom 中的z-index 样式设置为 -1时 苹果手机的效果是这样:



下面的一个小图片没了  ,

如果把z-index的值设置为 正数时 ,就可以了,如图



这里总结一下,今天发现了这个问题,故记录一下,我查了一些资料,别人应该也发现了这个问题。

然后z-index设置为负数时, 苹果手机为什么看不到呢,有可能是因为 body的z-index是0 倍body的元素挡住了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值