2016-01-20 74 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