2012-05-13 27 views
1

我想要在用戶第一次登錄網站時將大背景圖像拉伸到瀏覽器窗口的大小。從這裏,他們向下瀏覽網站的其他部分,但無論滾動瀏覽器窗口的大小如何,您都不會看到它(http://whiteboard.is就是一個很好的例子)。圖像不會垂直伸展到瀏覽器大小

我正在使用下面的代碼,當它橫向拉伸時,它不會垂直延伸超過最小高度。有任何想法嗎?

HTML

<body> 
<section id="first-section"> 
</section> 
</body> 

CSS

body, html { 
    font-family: Helvetica, Arial, sans-serif; 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    } 

#first-section { 
    background: url(1.jpg) no-repeat center center; 
    background-attachment: fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
    min-width: 1024px; 
    min-height: 768px; 
    } 
+0

我建議張貼這樣的問題之前創建的jsfiddle例如:一​​個例子http://jsfiddle.net/6VVUG/ –

回答

2

可能是你可以寫height:100%也。

#first-section { 
    background: url(1.jpg) no-repeat center center; 
    background-attachment: fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
    min-width: 1024px; 
    min-height: 768px; 
    height:100%; 
    } 
+0

感謝奏效一種享受:)曾爲這段時間,之前沒有工作。也許我刪除了一些影響它的東西哈哈。謝謝 :) –