2016-11-07 67 views
0

我正在练习css paralax,并且遇到了一个问题:在背景图片和下一个div之间存在白色的空白,您可以更改视口的宽度并向下滚动以查看它。如何删除paralax backgrond-image和下一个div之间的空白?

所以,我的问题是:为什么发生这种情况,我应该怎么做才能将其删除?

A screenshotLink on JSFiddle或 CSS代码:

.car { 
    position: relative; 
    width: 100%; 
    height: 600px; 
    background: url(http://i63.tinypic.com/14viwxk.png) no-repeat; 
    background-position: top left; 
    background-size: contain; 
    padding-top: 100px; 
    padding-bottom: 0; 
    overflow: hidden; 
    background-attachment: fixed; 
} 

.car h1 { 
    line-height: 1.2; 
} 

.car figure { 
    width: 40%; 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%); 
    left: 10%; 
    color: white; 
} 

figure p { 
    margin-bottom: 20px; 
} 

回答

0

你的形象简直是太小了。更改background-sizecover,看看你会得到什么

0

有什么要说@Hunter它是正确的,或者你可以改变height: 600px;height: 300px;或使用其他图片与高度:600px的