[英]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.