[英]How to create a full-coverage radial gradient?
I'm using a CSS code like the following one for creating a radial gradient background: 我正在使用类似下面的CSS代码来创建径向渐变背景:
body
{
background-color: #0176A0;
background-image: -moz-radial-gradient(center, ellipse cover, #029CC9 0%, #005077 100%);
background-image: -webkit-radial-gradient(center, ellipse cover, #029CC9 0%, #005077 100%);
background-image: -o-radial-gradient(center, ellipse cover, #029CC9 0%, #005077 100%);
background-image: -ms-radial-gradient(center, ellipse cover, #029CC9 0%, #005077 100%);
background-image: radial-gradient(center, ellipse cover, #029CC9 0%, #005077 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#029CC9', endColorstr = '#005077', GradientType = 0);
}
but the result is not the intended one! 但结果不是预期的! My aim is having a radial gradient background which covers the entire viewport.
我的目标是拥有一个覆盖整个视口的径向渐变背景。 I can use the
background-size
property which is a part of CSS3 specification to get a better result, but unfortunately this property does not work in IE? 我可以使用
background-size
属性,这是CSS3规范的一部分,以获得更好的结果,但不幸的是这个属性在IE中不起作用?
Does anyone have an idea please? 有人有想法吗?
Add this to your CSS: 将其添加到您的CSS:
html {
height: 100%
}
Even better: 更好的是:
html {
min-height: 100%;
}
This will make the gradient extend to your content height otherwise it will be limited to just the window height. 这将使渐变扩展到您的内容高度,否则它将仅限于窗口高度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.