The background of a website plays an important role to enhance its appearance. CSS3 has the ability to create color gradients which can be applied advantageously, for an appealing web page.
Linear gradient
The syntax for linear gradient background style is given below for the Web-kit, Mozilla (3.6 and higher versions) and IE browsers:
|
.linear_color_gradient
|
The first line of the syntax is for Webkit browsers (Google chrome and Safari), explanation for the same is provided below-
The web-kit gradient method accepts 5 attributes as listed below.
Starting and end points for different gradients in web-kit gradient method are listed below:
Second line of the syntax refers to Mozilla browsers, which accepts 4 attributes.
Explanation for the same is provided below -
Contrary to webkit-gradient method, in Mozilla, for vertical and horizontal gradients, only single reference is enough.
In addition to the above three, in Mozilla we can also specify the angle at which we want the gradient.
To skew the gradient at an angle of 60 degree: top 60deg.
The third line of the syntax refers to IE browsers:
For IE browsers we will not use "background," but rather "filter" to specify the background gradient. The style accepts 2 attributes:
Radial gradient
The radial gradient background can be applied to web pages using the following code:
|
.radial_color_ gradient |
The second line of syntax refers to the webkit browsers (Google Chrome / Safari), which accepts 7 attributes :
Limitations: The radial gradient effect doesn't reflect in IE browsers, tested upto version 8, but works perfectly well with a reliable web hosting.
Tags: CSS3 for background gradient, linear gradient in CSS3, radial gradient in CSS3, styles for gradient fill