Created
November 4, 2011 17:03
-
-
Save samsalisbury/1339851 to your computer and use it in GitHub Desktop.
dotLess CSS gradient mixin...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Based on output from http://www.colorzilla.com/gradient-editor/ | |
*/ | |
.linear-gradient(@r1, @g1, @b1, @a1, @p1, @r2, @g2, @b2, @a2, @p2, @r3, @g3, @b3, @a3, @p3, @r4, @g4, @b4, @a4, @p4) { | |
background: rgb(@r1,@g1,@b1); | |
background: -moz-linear-gradient(top, | |
rgba(@r1,@g1,@b1,@a1) @p1, | |
rgba(@r2,@g2,@b2,@a2) @p2, | |
rgba(@r3,@g3,@b3,@a3) @p3, | |
rgba(@r4,@g4,@b4,@a4) @p4); | |
background: -webkit-gradient(linear, left top, left bottom, | |
color-stop(@p1,rgba(@r1,@g1,@b1,@a1)), | |
color-stop(@p2,rgba(@r2,@g2,@b2,@a2)), | |
color-stop(@p3,rgba(@r3,@g3,@b3,@a3)), | |
color-stop(@p4,rgba(@r4,@g4,@b4,@a4))); | |
background: -webkit-linear-gradient(top, | |
rgba(@r1,@g1,@b1,@a1) @p1, | |
rgba(@r2,@g2,@b2,@a2) @p2, | |
rgba(@r3,@g3,@b3,@a3) @p3, | |
rgba(@r4,@g4,@b4,@a4) @p4); | |
background: -o-linear-gradient(top, | |
rgba(@r1,@g1,@b1,@a1) @p1, | |
rgba(@r2,@g2,@b2,@a2) @p2, | |
rgba(@r3,@g3,@b3,@a3) @p3, | |
rgba(@r4,@g4,@b4,@a4) @p4); | |
background: -ms-linear-gradient(top, | |
rgba(@r1,@g1,@b1,@a1) @p1, | |
rgba(@r2,@g2,@b2,@a2) @p2, | |
rgba(@r3,@g3,@b3,@a3) @p3, | |
rgba(@r4,@g4,@b4,@a4) @p4); | |
background: linear-gradient(top, | |
rgba(@r1,@g1,@b1,@a1) @p1, | |
rgba(@r2,@g2,@b2,@a2) @p2, | |
rgba(@r3,@g3,@b3,@a3) @p3, | |
rgba(@r4,@g4,@b4,@a4) @p4); | |
} | |
/* Usage... */ | |
.green-button-background { | |
.linear-gradient(88,154,30,1,0%,138,216,24,1,50%,123,202,32,1,51%,186,232,126,1,100%); | |
} | |
input[type=button] { | |
.green-button-background; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment