重复在视口停止背景图像:需要100%

时间:2013-03-13 22:24:16

标签: css image background repeat

我有一个小的.png文件重复形成背景图片。我需要将页面的body高度设置为100%才能在我的内容包装器上使用min-height属性。但是,尝试将背景图像与height:100%结合使用会导致在滚动页面时图像被切断。看图片详细说明我的意思:

背景在上面 enter image description here 但滚动时会被切断

这是一个小提琴:

http://jsfiddle.net/Nick_B/x2h3g/

即使在用户向下滚动后,如何在整个页面上重复显示背景图像?这是css:

body {  
    background-color:#9AAEBF; 
    overflow-y:scroll;
    height:100%;
}

html:after { /* from  www.css-tricks.com/snippets/css/transparent-background-images */
    background-image: url('http://www.example.com/img/background.png');    
    opacity:0.4;
    content: "";
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    position: absolute;
    z-index: -1;
}

感谢您的想法。

0 个答案:

没有答案
相关问题