Firefox 3.6 Released: With New CSS Gradient Feature

firefox-logoMozilla has finally released Firefox 3.6, the newest version of its popular browser after months of testing. New Firefox is 20% faster than Firefox 3.5, according to Mozilla. It uses Gecko 1.9.2 web-rendering, which improves its load times, startup speed and stability. Javascript execution is faster and smoother as well. There’s also autocomplete form functionality and full HTML5 support. New feature called Personas has been added in Firefox 3.6 which lets you customize your Firefox with a single click and without a restart. My Favourite feature is the addition of new CSS Gradient API. You can define Gradient effect on any element by specifying simple CSS styles. Thus now you can have CSS Gradient Effect without Images! Note: All the below examples are Images. In order to view the gradient effect one must use Firefox 3.6

Liner Gradient

To create a linear gradient, you’ll need to set a starting point and a direction (or angle) for the gradient and to define the color stops.
-moz-linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, <stop>]* )
Code language: CSS (css)
Starting Point: The starting point works just like background position. You can set the horizontal and the vertical positions as a percentage, in pixels, or using left/center/right for horizontal, and top/center/bottom for vertical. Positions start from the top left corner. If you don’t specify the horizontal or the vertical position, it will default to center. Example
.linear_gradient_square { width: 100px; height: 100px; border: 1px solid #333; background: -moz-linear-gradient(top, blue, white); }
Code language: CSS (css)
One that starts left (horizontal) and center (vertical):
background: -moz-linear-gradient(left, blue, white);
Code language: CSS (css)
Here’s a simple example with three color stops. Because no point is specified for the first and last colors, they will default to 0% and 100%.
background: -moz-linear-gradient(top, blue, white 80%, orange);
Code language: CSS (css)
Colors will be evenly spaced if no position is specified.
background: -moz-linear-gradient(left, red, orange, yellow, green, blue);
Code language: CSS (css)

Radial Gradients

The syntax for radial gradients is very similar to that of linear gradients:
-moz-radial-gradient([<bg-position> || <angle>,]? [<shape> || <size>,]? <color-stop>, <color-stop>[, <color-stop>]*);
Code language: CSS (css)
Color stops: Just like with linear gradients, you should define color stops along the gradient line. The following circles have the same color stops, but the gradient on the left defaults to evenly spaced colors, while the one on the right has a specific position for each color.
background: -moz-radial-gradient(red, yellow, #1E90FF); background: -moz-radial-gradient(red 5%, yellow 25%, #1E90FF 50%);
Code language: CSS (css)
.radial_gradient_circle { background: -moz-radial-gradient(bottom left, circle, red, yellow, #1E90FF); } .radial_gradient_ellipse { background: -moz-radial-gradient(bottom left, ellipse, red, yellow, #1E90FF); }
Code language: CSS (css)
background: -moz-radial-gradient(ellipse closest-side, red, yellow 10%, #1E90FF 50%, white); background: -moz-radial-gradient(ellipse farthest-corner, red, yellow 10%, #1E90FF 50%, white);
Code language: CSS (css)
.repeating_radial_gradient_example { background: -moz-repeating-radial-gradient(black, black 5px, white 5px, white 10px); } .repeating_linear_gradient_example { background: -moz-repeating-linear-gradient(top left -45deg, red, red 5px, white 5px, white 10px); }
Code language: CSS (css)
Get our Articles via Email. Enter your email address.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *