Need to understand linear-gradient property

Hi there

I am using linear-graident property of CSS3 to create background and effects with mix color

but I want to understand its syntax in more details

I am following this guideline CSS Gradient

and I by following This Link I have made this jsfiddle http://jsfiddle.net/KcsM2/180/

my question is:

  1. is there any link that contain all directions that are supported by linear-graident property?

2)What is % value after color name is it start range or upto range?

As a first suggestion, stop using w3schools as a reference point, particularly for relatively new CSS properties such as linear-gradient - the newer the property, the less likely it is that you’ll find what you’re looking for there. Try taking a look at the Mozilla Developer Network site instead, and pages such as these specifically:

linear-gradient reference

repeating-linear-gradient

The first of those links should answer all of your questions.

You can also use the Codrops CSS reference, as that’s also well maintained. This is their page on linear-gradient

Codrops linear-gradient reference

5 Likes

Using the keywords, there are 8 directions, representing the corners and sides of a box, to top left - to top etc…
Or you may give any direction in degrees within the 360 degree range: 24deg

The % defines where between the start and end the colour is, 50% being half way, 25% one quarter etc. You may specify a % value beyond 100% to place a colour past the end point.
You may use other units to define the colour placement, such as px or em, but % is particularly useful in gradients.

Note that in your fiddle you are using the -webkit- prefix and no version without the prefix. This will cause the css to fail in the majority of browsers that do not require the prefix.

4 Likes

Thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.