CSS固定背景左侧有白线

时间:2012-08-21 12:37:23

标签: css background webkit

我尝试用

在我的整个页面上添加背景
html {
    background: url(images/panda.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

这通常很好用,但我发现了一个问题:屏幕的左侧是白色条纹。有可能解决这个问题吗?

PS:提前:不,那条纹不在画面上。您可以了解它的外观:

enter image description here

编辑:http://jsfiddle.net/uhwcW/ 当放大/缩小时,白色条纹有时会消失或切换到侧面......令人困惑。

4 个答案:

答案 0 :(得分:0)

尝试;

margin: 0;
padding: 0

html的CSS中。

答案 1 :(得分:0)

你试过重置身体吗?也可以尝试使用其他容器,也许这只是你看到的一些边缘或填充......

body { 
   margin: 0;
   padding:0;
}

答案 2 :(得分:0)

这对我有用..

html{
    background: url(..//index3.jpg) no-repeat 0 0 fixed; 
    -webkit-background-size: cover;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    -moz-background-size: cover;

}

答案 3 :(得分:0)

在网址为我添加后,只需添加一个中心

像这样:

background: url(images/panda.jpg) center;