[英]Background Image not displaying on iPhone
如何使背景图像在 iPhone 上显示为在 Android 上显示?
HTML
<div class="bgimg-1">
<div class="hometoptext ">
<h1 class="text-center">
Africa's First Online Business Lender
</h1>
<div>
<h3 class="thin">Grow faster with South Africa's most innovative online funder</h3>
</div>
<div class="text-center">
<button class="btn btn-primary" (click)="applyNow()">APPLY NOW</button>
</div>
</div>
<div class="bottom-arrow text-center">
</div>
</div>
背景图像不显示在 iPhone 上
CSS
.bgimg-1 {
background-image: url("img/main_pic2.png");
color: white;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-color: #999;
position:relative;
width:100%;
min-height: 100vh;
top: 0;
}
Android上的图像:
iPhone上的图像:
background-size: cover;
上有错误行为。 + background-attachment: fixed
;background-size: cover;
上有错误行为。 在页面的正文上。background-size
存在帧速率问题。background-size
百分比参考:链接
这个问题的一个可能的解决方案仍然是纯 CSS Fallback
CSS Tricks有三个很棒的方法,后两个是当 CSS3 的封面不起作用时的后备。
HTML
<img src="img/main_pic2.png" id="bg" alt="">
CSS
#bg {
position: fixed;
top: 0;
left: 0;
/* Preserve aspect ratio */
min-width: 100%;
min-height: 100%;
}
iOS 设备不支持背景图像。 证明链接: https ://caniuse.com/?search=background-url
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.