开发者

Background position won't position itself

开发者 https://www.devze.com 2022-12-16 12:29 出处:网络
I have my site wrapped in one big DIV, called wrapper, that starts just after <body> and ends right before it. I.e.

I have my site wrapped in one big DIV, called wrapper, that starts just after <body> and ends right before it. I.e.

<body>
  <div id="wrapper">
    ... website ...
  </div>
</body> 

I have the following code styling #wrapper

#wrapper {
 width: 960px;
 margin: 0 auto;
 padding: 0 7px;
 background: #c1cca0 url(images/fade.gif) repeat-y scroll 0 300px;
}

However, the background starts repeating at the very top of the page, instead of 300 pixels down. Can I not use repeat-y in conjunction with background-position, or is there something els开发者_运维百科e I'm missing?


I'm not sure, but could you try to define the background-position using it's own property, like:

background-position: 0px 300px;

Please tell, if this will fix it.


Can I not use repeat-y in conjunction with background-position,

Yes you are right .. There is no meaning to the combination of repeat-y and absolution position .. repeat-y overrides ..
I don't know what fade.gif exactly is (as it is only literal in your code) .. so can't try for the alternative solution ..


I may be wrong here but I think the source of your problem is that the #wrapper has no height of its own. Try giving it a fixed height to test this out.... i.e. #wrapper {height: 500px;}

0

精彩评论

暂无评论...
验证码 换一张
取 消