在我将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 );}发布于 2013-08-28 18:43:54
如果希望渐变填充视图,请尝试向<html>和<body>元素添加一个高度:
html, body {
height: 100%;
}示例:http://jsfiddle.net/xZKPJ/3/
https://stackoverflow.com/questions/18495723
复制相似问题