1
body
{
background-image: -webkit-linear-gradient(bottom, #FFFFFF 0%, #787878 100%);
}

当然,当我想要一个真正的渐变时,我会得到这种效果。有任何想法吗?

4

2 回答 2

2

You make this work properly, you need:

body, html {
  background: -webkit-linear-gradient(top, #FFFFFF 0%, #787878 100%);
  margin:0;
  height:100%; 
}
于 2012-06-05T18:25:33.527 回答
1

试试这个:http: //jsfiddle.net/3rb2L/2/

body
{
   background-image: -webkit-linear-gradient(top, #2F2727, #1a82f7); 
   background-repeat: no-repeat;
   height:200px;
}

height:200px仅用于示例和明确的查看目的。

可以用作:http: //jsfiddle.net/3rb2L/4/

html{
  min-height:100%;
}
body
{
   background-image: -webkit-linear-gradient(top, #2F2727, #1a82f7); 
   background-repeat: no-repeat;
}
于 2012-06-05T18:23:52.993 回答