2015-01-15 47 views
0

我有一個手風琴頁面,當手風琴打開時背景不會填滿整個頁面。CSS - 背景漸變不能覆蓋整個頁面,因爲它增長

下面是我到目前爲止所嘗試的。

.models-background { 
    /* IE10 Consumer Preview */ 
    background-image: -ms-linear-gradient(top, #666666 0%, #E6E6E6 100%); 

    /* Mozilla Firefox */ 
    background-image: -moz-linear-gradient(top, #666666 0%, #E6E6E6 100%); 

    /* Opera */ 
    background-image: -o-linear-gradient(top, #666666 0%, #E6E6E6 100%); 

    /* Webkit (Safari/Chrome 10) */ 
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #666666), color-stop(1, #E6E6E6)); 

    /* Webkit (Chrome 11+) */ 
    background-image: -webkit-linear-gradient(top, #666666 0%, #E6E6E6 100%); 

    /* W3C Markup, IE10 Release Preview */ 
    background-image: linear-gradient(to bottom, #666666 0%, #E6E6E6 100%); 

    background-size: 100% 100%; 

    background-repeat: no-repeat; 

    background-size: cover; 
} 
+0

這裏已經回答: http://stackoverflow.com/questions/14330909/scaling-gradient-backgrounds-in-css 如果沒有指定將切斷圖片中的梯度。 –

回答

0
add at the beginning of the CSS code: 

{ 

min-height: 100% ; 
min-width: 100% ; 

<!-- add your stuff :) --> 
} 

如果您想引用其他職位:

previous question 1:縮放梯度 Previous question 2:縮放背景

希望它能幫助。