【问题标题】:Background image not shown in android phonegap appandroid phonegap 应用程序中未显示背景图像
【发布时间】:2015-05-12 11:55:12
【问题描述】:

我正在尝试使用 CSS 在 Android phonegap 应用上显示背景图片。这是示例 HTML

<html>
<head>
    <title>Login page</title>
 </head>
<body style="margin: 0px; background: url("img/bg_index.jpg";) repeat scroll 50% 0px / cover  transparent;">
</body>
</html>

使用此代码时,背景图像不会在某些 android 手机(如索尼爱立信)中显示,但在大多数 android 手机和 iphone 中,此代码都可以正常工作。

所以我尝试改变样式如下所示

<html>
<head>
    <title>Login page</title>
 </head>
<body style="margin: 0px;background: url("img/bg_index.jpg";) repeat scroll 50% 0px / cover  transparent; background-image: url("img/bg_index.jpg";);background-repeat:no-repeat;">
</body>
</html>

应用此样式后,应用启动如下图

如何编写一个所有android设备和iphone都接受的背景样式

【问题讨论】:

    标签: android html css cordova phonegap-build


    【解决方案1】:

    试试这个:

    background: url("../img/bg_index.jpg");
    

    【讨论】:

    • 文件夹结构 login.html - www/app/login.html img - www/app/img 所以我认为访问图像没有问题
    【解决方案2】:

    只需这样做:

    background: url("your/path/img/bg_index.jpg");
    

    【讨论】:

      【解决方案3】:
      div {
      background-image:url('smiley.gif');
      background-repeat:no-repeat;
      background-size:100% 100%;
      }
      

      【讨论】:

        【解决方案4】:
        #first-bg {
            background-image: url('http://go.sap.com/_jcr_content/par/hero_a9cf/image.adapt.subtablet.jpg/1426599556769.jpg');
            background-size: 100%;
            height: 600px;
            background-repeat: no-repeat;
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-07-14
          • 2016-02-13
          • 1970-01-01
          • 2012-12-25
          • 1970-01-01
          相关资源
          最近更新 更多