我試圖找到解決方案,我在iOS設備上使用固定背景的問題。我寧願不必爲本網站重新設計所有內容,我希望有一些CSS更改可以解決它。 This就是這個網站在iPhones上的樣子,this就是它應該的樣子。我使用的CSS代碼如下:背景附件:固定不適用於iOS
.container {
min-width: 320px;
max-width: 480px;
margin: 0 auto;
}
.fixed-background {
height: 800px;
-webkit-backgound-size: cover;
-o-backgound-size: cover;
-moz-backgound-size: cover;
background-size: cover;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center center;
text-align: center;
overflow: auto;
}
我也使用@media
查詢來修復它使用計算器上的一些帖子的iOS嘗試,但這似乎並沒有產生任何影響:
@media screen and (min-color-index:0) and (-webkit-min-device-pixel-ratio:0) {
.fixed-background {
background-attachment: scroll;
}
}
HTML
<div class="fixed-background bg-1">
<div class="container">
<div class="title">
<h1>ROOK PROPERTY<br>MANAGEMENT INC.</h1>
<h2>CONDOMINIUM MANAGEMENT</h2>
</div>
</div>
</div>
你有沒有試過這個 http://stackoverflow.com/questions/23236158/how-to-replicate-background-attachment-fixed-on-ios – Shashi
經過一番辯論後,我結束了剛剛使用position:scroll for the mobile CSS。感謝您的信息。 –
我認爲這回答你的問題:http://stackoverflow.com/questions/24154666/background-image-size-cover-not-working-on-ios/43058483#43058483 –