Nic*_*nto 9 css android google-chrome ruby-on-rails-3 twitter-bootstrap
这真让我困惑.我希望pic.jpg在背景中是静态的(滚动时不移动)并且它不会拉伸.
它适用于除Android上的Chrome之外的所有浏览器(即Chrome,Safari,Firefox)(它甚至适用于Android原始浏览器)
body{
background-color: transparent !important;
background-image: url(<%= asset_path "pic.jpg" %>);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Run Code Online (Sandbox Code Playgroud)
Chrome for Android将其呈现为pic.jpg在屏幕中间位于半边,而不是在整个页面上,并且在滚动时不会保持静态.
我无法在jsfiddle上重现它,我也尝试使用我的Android手机调试它,似乎没有任何帮助.
这不是创建背景图像的方法吗?
我不想残酷,但大约4年前曾报告过此问题
http://code.google.com/p/android/issues/detail?id=3301
最近的回答可以帮助我猜测:
在Android上进行的实验中,我注意到体内所有其他DIV的行为都正确,包括居中,因此我将图像移到了另一个DIV上并起作用了。
好笑的一个。
最好
小智 5
我有类似的问题..我用这个解决
html{
height:100%;
min-height:100%;
}
body{
min-height:100%;
}
Run Code Online (Sandbox Code Playgroud)