When I want to create a gradient background in CSS3 I have to do this:
background-color: #3584ba;
background-image: -webkit-gradient(linear, left top, left bottom, from(#54a0ce), to(#3584ba)); /* Safari 4+, Chrome */
background-image: -webkit-linear-gradient(top, #54a0ce, #3584ba); /* Safari 5.1+, Chrome 10+ */
background-image: -moz-linear-gradient(top, #54a0ce, #3584ba); /* FF3.6 */
background-image: -o-linear-gradient(top, #54a0ce, #3584ba); /* Opera 11.10+ */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#54a0ce', endColorstr='#3584ba'); /* IE */
and this is really annoying. Is there a better solution, for example a jQuery plugin, that will make my code cross browser compatible, if I just use:
background-image: -webkit-linear-gradient(top, #54a0ce, #3584ba); /* Safari 5.1+, Chrome 10+ */
for example?
Is there a tool to help me write CSS3 code more easy?
There are many tools for this:
These are generally referred to as CSS Preprocessors.
You would end up writing something like this once, like a function definition (usually called a “mixin”):
Then to apply:
Highly recommend.