【发布时间】:2020-03-13 00:36:14
【问题描述】:
在 iOs 设备中 background-attachment: fixed; 不起作用,所以我找到了使用 @supports CSS 规则的解决方法。
它在 testground 站点中正常工作,但是当我尝试将它应用到主站点 css 时它没有工作。
在测试场站点中,我通过以下方式将其直接应用到<head>:
<style>
.paral2 {
min-height: 300px;
background-attachment: fixed;
background-size: auto;
background-position: center;
background-repeat: no-repeat;
}
@supports (-webkit-touch-callout: none) {
.paral2 {
min-height: 300px;
background-attachment: scroll;
background-size: auto;
background-position: center;
background-repeat: no-repeat;
}
}
</style>
但在主站点中,我必须(根据客户要求)使用style.css 文件,所以我这样应用它:
@supports (-webkit-touch-callout: none) {
.paral {
min-height: 300px;
background-attachment: scroll;
background-size: auto;
background-position: center;
background-repeat: no-repeat;
}
}
.paral {
min-height: 300px;
background-attachment: fixed;
background-size: auto;
background-position: center;
background-repeat: no-repeat;
}
它不起作用,我不知道为什么,我完全迷路了。
可能是相关的,在style.css 文件中,@supports 规则及其以下元素看起来很奇怪,请参见下图:
只有.paral 类中的第一个元素被涂成黄色。
任何形式的帮助都将不胜感激,并一如既往地提前致谢。
【问题讨论】:
标签: css ios bootstrap-4 webkit