Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 背景附件:固定在手机上_Android_Ios_Css_Fixed_Background Attachment - Fatal编程技术网

Android 背景附件:固定在手机上

Android 背景附件:固定在手机上,android,ios,css,fixed,background-attachment,Android,Ios,Css,Fixed,Background Attachment,我正在尝试为spn web应用程序设置背景图像,我需要修复背景(它不会与页面的其余部分一起滚动) 这是css的主体: body { background-color: rgb(51, 102, 102); background-image: url('../images/background.png'); background-attachment: fixed; background-position: center; color: #eee; } IOS上的Safari

我正在尝试为spn web应用程序设置背景图像,我需要修复背景(它不会与页面的其余部分一起滚动)

这是css的主体:

body {
  background-color: rgb(51, 102, 102);
  background-image: url('../images/background.png');
  background-attachment: fixed;
  background-position: center;
  color: #eee;
}
IOS上的Safari和Android上的Chrome会重复背景,而不是一次性修复


我在互联网上看到它在移动设备上被禁用了,但有解决方案吗?

有其他选择,但这是唯一一个真正对我有效的方法;我试了几乎所有的

background-repeat: no-repeat;
background-position: center center;
将div设置在初始标记的正下方。然后将图像应用于div中的html。同时给出div和id属性(本例中为#background _wrap)。 …我在没有应用html中的实际图像链接的情况下尝试了这个方法,但它始终无法正常工作,因为在将图像应用到css中的背景时,仍然必须使用“background image:”属性。让它在移动设备上工作的诀窍是不使用任何背景图像设置。这些值对于我的项目来说是特定的,但对于我的固定背景图像来说,它非常适合于在移动和更大的计算机视口中保持居中和响应。可能需要对特定项目的值进行一些调整,但值得一试!我希望这有帮助

<body>
     <div id="background_wrap"><img src="~/images/yourimage.png"/></div>
</body>

有其他的选择,但这是唯一一个真正为我工作;我试了几乎所有的

将div设置在初始标记的正下方。然后将图像应用于div中的html。同时给出div和id属性(本例中为#background _wrap)。 …我在没有应用html中的实际图像链接的情况下尝试了这个方法,但它始终无法正常工作,因为在将图像应用到css中的背景时,仍然必须使用“background image:”属性。让它在移动设备上工作的诀窍是不使用任何背景图像设置。这些值对于我的项目来说是特定的,但对于我的固定背景图像来说,它非常适合于在移动和更大的计算机视口中保持居中和响应。可能需要对特定项目的值进行一些调整,但值得一试!我希望这有帮助

<body>
     <div id="background_wrap"><img src="~/images/yourimage.png"/></div>
</body>