Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a full-coverage radial gradient?

Tags:

html

css

I'm using a CSS code like the following one for creating a radial gradient background:

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?
Does anyone have an idea please?

like image 252
moorara Avatar asked Apr 18 '12 08:04

moorara


People also ask

What is a radial gradient?

radial-gradient() The radial-gradient() CSS function creates an image consisting of a progressive transition between two or more colors that radiate from an origin. Its shape may be a circle or an ellipse.

Can you create repetitive patterns with radial gradient?

repeating-radial-gradient() The repeating-radial-gradient() CSS function creates an image consisting of repeating gradients that radiate from an origin.

Which CSS gradient function creates a radial gradient that repeats infinitely?

CSS repeating-radial-gradient() Function The repeating-radial-gradient() function is used to repeat radial gradients.


1 Answers

Add this to your CSS:

html {
    height: 100%
}
like image 177
Circle B Avatar answered Nov 13 '22 21:11

Circle B