2016-11-07 41 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的