css - 固定的背景附件在 iOS5 中工作吗?

标签 css ios

这是否适用于 > iOS 5?

.element {
    background: url(images/myImage.jpg) 50% 0 no-repeat fixed;
}

我认为它应该,但到目前为止还没有。

最佳答案

您可以使用一个单独的元素和 position: fixed 来解决这个问题!

HTML:

<div id="Background"></div>

<div id="Content"></div>

CSS:

#Background {
    background: #000 url("img/Background.jpg") no-repeat 50% 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1
}

关于css - 固定的背景附件在 iOS5 中工作吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9779195/

相关文章:

iOS,无法委托(delegate)viewDidLoad之外

ios - 查看高度问题(续)

ios - 我们如何在 Delphi iOS 中使用 Open SSL?

ios - 禁用 Cookie UIWebView Swift iOS

php - 如何将一些类添加到 wordpress 菜单链接?

javascript - Twitter 的 Typeahead 限制不起作用

html - 如何将 Font Awesome 图标添加到 &lt;input&gt; 按钮中?

javascript - Bootstrap - 'data-original-title=' 在我尝试创建工具提示时显示为灰色

html - 使子导航菜单出现在悬停在主导航列表项上

ios - 在 iOS 上的 SpriteKit 中,缩放带纹理的 Sprite 会产生不正确的帧?