2012-03-05 104 views
3

上没有被应用我有一个简单的网页,其中有在中间有一个.container询问一些用户信息:背景整个屏幕

height: auto;    width: 300px; 
background: white;   margin-left: auto; 
margin-top: 10%;   margin-right: auto; 
padding: 50px 20px 20px; border-radius: 3px; 
-moz-border-radius: 3px; -webkit-border-radius: 3px; 

下面这个我有使用position: fixed;例如,定义了三个独立的部门:

position: fixed;  z-index: -10; 
bottom:2%;   width: 100%; 
text-align: center; color: #eaeaea; 

现在的问题是,如果我在我的身体标记上使用渐变,它只是覆盖了容器所在的位置的背景。之后,它停止这样做:

body { 
background-color: #851207 no-repeat; 
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(133, 18, 7)), to(rgb(83, 9, 3))) no-repeat; 
background-image: -webkit-linear-gradient(top, rgb(133, 18, 7), rgb(83, 9, 3)) no-repeat; 
background-image: -moz-linear-gradient(top, rgb(133, 18, 7), rgb(83, 9, 3)) no-repeat; 
background-image: -o-linear-gradient(top, rgb(133, 18, 7), rgb(83, 9, 3)) no-repeat; 
background-image: -ms-linear-gradient(top, rgb(133, 18, 7), rgb(83, 9, 3)) no-repeat; 
background-image: linear-gradient(top, rgb(133, 18, 7), rgb(83, 9, 3)) no-repeat; 
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#851207', EndColorStr='#530903') no-repeat; 
} 

我使用no-repeat这里,因为否则它被重复利用其间的突出线的梯度。我也尝试过与另一个使用梯度div

有什么建议吗?

+0

将是最好的设置给我们看的HTTP的例子://的jsfiddle。网 – Henesnarfel 2012-03-05 13:03:21

回答

3

你必须提供一个宽/高到html元素:

html { 
    width: 100%; 
    height: 100%; 
} 

DEMO

+0

这个伎俩!谢谢。 – Namit 2012-03-05 13:12:24

0

Juste给你的身体分高度。

body { 
    min-height: 100%; 
}