网站背景图像显示在笔记本电脑和安卓手机等所有其他设备上。但不仅限于 iOS 移动版。我什至将图像调整为 768 px * 365 px 但无法正常工作。
.bg-img {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: -1;
background-position: center;
background-size: cover;
background-attachment: fixed;
}
.bg-img .overlay {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
opacity: .8;
background: #1C1D21;
}
<!-- Background Image -->
<!-- large device only -->
<div class="visible-xl visible-lg visible-md hidden-sm hidden-xs">
<div class="bg-img" style="background-image: url('./img/team/background-clouds-dark-957002.jpg');">
<div class="overlay"></div>
</div>
</div>
<!-- mobile only -->
<div class="visible-xs visible-sm hidden-md hidden-lg hidden-xl">
<div class="bg-img" style="background-image: url('./img/team/Smallsize.jpg');">
<div class="overlay"></div>
</div>
</div>
<!-- /Background Image -->
最佳答案
css 取决于浏览器而不是 os 请安装chrome进行测试。或为单独的浏览器使用 css
#urID{
background:url("../images/bg.jpg") no-repeat scroll right top #000000;
-o-background-size: cover;
-moz-background-size: cover;
-webkit-background-size:cover;
background-size: cover;
}
关于html - slider 背景图像不显示在 ios 移动设备上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54783058/