【问题标题】:CSS background not showing up on mobileCSS背景未显示在移动设备上
【发布时间】:2012-08-28 17:45:56
【问题描述】:

在移动设备(尤其是 iPhone)上查看网站时,我的背景图片无法正确显示。我可以在那里看到它只是不在正确的位置。我附上了一个图片链接,显示了背景是如何呈现的,以及一个指向该网站的链接。

如果有人有解决此问题的答案,我将非常感谢任何建议。

提前致谢。

http://mikedemar.com/weightloss4youth/bgissue

http://mikedemar.com/weightloss4youth/index.html

【问题讨论】:

  • 我会尝试添加background-size: 100%; 从那里开始并查看。
  • 好主意,但是在浏览器上查看时这弄乱了背景。

标签: iphone html css mobile background-image


【解决方案1】:

不妨试试这个:

html { 
        background: url(images/bg.jpg) no-repeat center center fixed; 
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-size: cover;
    }

您可以在以下位置查看其他方法:http://css-tricks.com/perfect-full-page-background-image/

【讨论】:

    【解决方案2】:

    我的一个朋友建议我删除“width=device-width”并将背景大小设置为 2560px 1440px。这是完美的工作。见链接。

    http://mikedemar.com/weightloss4youth/index.html

    【讨论】:

      【解决方案3】:

      试试这个

      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      

      【讨论】:

      猜你喜欢
      • 2014-06-28
      • 2016-02-18
      • 1970-01-01
      • 2014-09-05
      • 2013-05-08
      • 1970-01-01
      • 2021-03-18
      • 2023-02-20
      • 1970-01-01
      相关资源
      最近更新 更多