2016-01-20 77 views
0

我使用引導:http://ironsummitmedia.github.io/startbootstrap-simple-sidebar/ 我想改變這個白色背景,但是當我生成一些數據和滾動頁面時,它仍然是白色的。Bootstrap,滾動後沒有背景

enter image description here

我已經在這個引導程序改爲僅此:

html, body { 
    height: 100%; 

} 

#wrapper { 
    height: 100%; 
    width: 100%; 
    background: red; 
+1

你限制的相關要素視口高度的100%,這裏的高度 - 這樣超越了所有的內容,如果其容器流出元素,它不會增加超過100%的高度 - 這就是爲什麼你看到一個白色背景,因爲這部分是在你指定的紅色背景的元素之外。改爲在包裝上使用'min-height:100%'。 (或者'min-height:100vh' - 那麼你不需要爲'html'和'body'設置'height:100%''',這會導致滾動行爲等更多的問題。) – CBroe

回答

1

難道你現在只是有

body { background-color: red; }

或漸變,你可以這樣做: -

#wrapper { background: red; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(red, yellow); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(red, yellow); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(red, yellow); /* For Firefox 3.6 to 15 */ background: linear-gradient(red, yellow); /* Standard syntax */ height: 100vh; }

+0

如果我添加到身體和包裝是工作。但它是分開的。我想在後臺漸變。不管怎樣,謝謝。 – kkkkk

+0

使用漸變中的任何一種方法有什麼捷徑?例如一個這個:http://codepen.io/taylorvowell/pen/BkxbC – kkkkk

+0

你想垂直漸變? – nsilva

0

試試這個

#wrapper { 
height: 100vh; 
width: 100%; 
background: red; 
} 
+0

沒有改變。它仍然看起來像一張照片 – kkkkk

+0

這是行不通的,只是在您的網站上試過它 – nsilva

+1

@ user3797879因此,請嘗試上面的答案,它是'身體{background:red; }' – Maometto