简体   繁体   English

背景重复-y,但不在页面下方

[英]background repeat-y but not below page

I have a background image which i need to display vertically as long as the content on the page, but, my background image only shows to the page in view and when I scroll down for the rest of the content the background is not shown in the rest of the page. 我有一个背景图片,需要与页面上的内容一样垂直显示,但是,我的背景图片只显示在视图中的页面上,当我向下滚动到其余内容时,背景不会显示在页面中页面的其余部分。 What am I doing wrong? 我究竟做错了什么?

css for the background image CSS作为背景图片

#wrapper {
text-align: left;
margin: 0px auto;
border:0;
width: 960px;
height: 100%;
background-image: url('/images_/backgrounds/content_shadow.png');
background-repeat: repeat-y;
}

尝试将背景图片和背景重复规则应用于正文,而不是#wrapper。

My guess is that the wrapper div isn't extending to the bottom of the content either. 我的猜测是包装div也没有扩展到内容的底部。 Try setting the border of wrapper to: 尝试将包装器的边框设置为:

border: 1px solid black;

You might find that the background is behaving just fine, and the div isn't doing what you want. 您可能会发现背景表现良好,并且div并未执行您想要的操作。

而是将背景图片样式应用于html {}。

Try adjusting the height property, the 100% is relative to what? 尝试调整height属性,相对于100%是什么? Generally i prefer defining height rules with min-height. 通常,我更喜欢用min-height定义高度规则。

remove the height: 100%; 去除height: 100%; from css. 从CSS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM