0

在我将 doctype 更改为 html5 后,背景渐变变得混乱,看起来像这样: 乱

如果我再次删除它,它会再次变为平滑渐变。

我的 CSS 代码如下:

body {
background: #3c99d4;
background: -moz-radial-gradient(center, ellipse cover,  #81e8f9 0%, #0358b5 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#81e8f9), color-stop(100%,#0358b5));
background: -webkit-radial-gradient(center, ellipse cover,  #81e8f9 0%,#0358b5 100%);
background: -o-radial-gradient(center, ellipse cover,  #81e8f9 0%,#0358b5 100%);
background: -ms-radial-gradient(center, ellipse cover,  #81e8f9 0%,#0358b5 100%);
background: radial-gradient(ellipse at center,  #81e8f9 0%,#0358b5 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#81e8f9', endColorstr='#0358b5',GradientType=1 );}
4

1 回答 1

2

如果您希望渐变填充视口,请尝试为<html>和元素添加高度:<body>

html, body {
  height: 100%;
}

示例:http: //jsfiddle.net/xZKPJ/3/

于 2013-08-28T18:43:54.770 回答