1

我正在处理的网站 ( http://tinyurl.com/ax68brt ) 的背景图片无法在手机浏览器上正确显示。问题出现在 outheader、outbeurzen 和 outtwitter div 上。标题背景未以 100% 宽度显示,并且 outbeurzen/outtwitter div 的背景也未正确显示。

这里出了什么问题?

html:

<div id="outheader"></div>
<div id="outintro"></div>
<div id="outbeurzen"></div>
<div id="outfoto"></div>
<div id="outtwitter"></div>
<div id="outfooter"></div>

CSS:

#outheader {
background-image: url(images/achtergrond/header.jpg);
float: left;
height: 660px;
width: 100%;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: 50% 0px;
margin: 0px;
padding: 0px;}

    #outintro {
background-image: url(images/achtergrond/body.jpg);
float: left;
height: auto;
width: 100%;
background-attachment: fixed;
background-repeat: repeat-y;
background-position: 50%;
padding-top: 60px;
padding-bottom: 60px;
    }

    #outbeurzen {
background-image: url(images/achtergrond/beurzen.jpg);
float: left;
height: 315px;
width: 100%;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: 50% -300px;
    }

    #outfoto {
background-image: url(images/achtergrond/body.jpg);
float: left;
height: auto;
width: 100%;
background-attachment: fixed;
background-repeat: repeat-y;
background-position: 50%;
margin-bottom: 70px;
margin-top: 70px;
    }

    #outtwitter {
background-image: url(images/achtergrond/twitter.jpg);
float: left;
height: 315px;
width: 100%;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: 50%;
font-family: 'Roboto Condensed', sans-serif;
    }

    #outfooter {
background-image: url(images/achtergrond/body.jpg);
float: left;
height: 240px;
width: 100%;
background-attachment: fixed;
background-repeat: repeat-y;
background-position: 50%;
    }
4

2 回答 2

5

你不应该background-attachment: fixed;在移动浏览器上使用,它有问题而且重绘成本太高。见费

Android/Mobile Webkit CSS Background-Attachment:固定不工作?或者

https://twitter.com/paul_irish/status/306818591196602368

您的<meta name="viewport" … >网站上还缺少一个(视口元)标签,请参阅https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag

于 2013-03-03T23:17:32.070 回答
0

在 html 标头部分给出元标记。

 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
于 2015-06-01T09:54:50.517 回答