Skip to content

Instantly share code, notes, and snippets.

@meltingice
Created April 28, 2011 18:48
Show Gist options
  • Save meltingice/947009 to your computer and use it in GitHub Desktop.
Save meltingice/947009 to your computer and use it in GitHub Desktop.
CSS3 LESS Mini-Library
.background-gradient(@start, @stop) {
background-image:-moz-linear-gradient(top, @start, @stop);
background-image:-o-linear-gradient(top, @start, @stop);
background-image:-webkit-gradient(linear, lefttop, leftbottom, color-stop(0, @start), color-stop(1, @stop));
background-image:-webkit-linear-gradient(@start, @stop);
background-image:linear-gradient(top, @start, @stop);
filter: e("progid:DXImageTransform.Microsoft.gradient(startColorStr='") @start e("',EndColorStr='") @stop e("')");
}
.transition(@element, @duration, @easing) {
-moz-transition: @element @duration @easing;
-webkit-transition: @element @duration @easing;
-o-transition: @element @duration @easing;
-ms-transition: @element @duration @easing;
transition: @element @duration @easing;
}
.border-radius(@topleft, @topright, @bottomright, @bottomleft) {
border-top-left-radius: @topleft;
border-top-right-radius: @topright;
border-bottom-right-radius: @bottomright;
border-bottom-left-radius: @bottomleft;
-webkit-border-top-left-radius: @topleft;
-webkit-border-top-right-radius: @topright;
-webkit-border-bottom-right-radius: @bottomright;
-webkit-border-bottom-left-radius: @bottomleft;
-moz-border-radius: @topleft @topright @bottomright @bottomleft;
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
.uniform-border-radius(@radius) {
border-radius: @radius;
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
}
.box-shadow(@top, @left, @size, @color) {
-moz-box-shadow: @top @left @size @color;
-webkit-box-shadow: @top @left @size @color;
box-shadow: @top @left @size @color;
}
.inset-box-shadow(@top, @left, @size, @color) {
-moz-box-shadow: inset @top @left @size @color;
-webkit-box-shadow: inset @top @left @size @color;
box-shadow: inset @top @left @size @color;
}
.box-rotate(@amt) {
-moz-transform: rotate(@amt);
-o-transform: rotate(@amt);
-webkit-transform: rotate(@amt);
-ms-transform: rotate(@amt);
transform: rotate(@amt);
zoom: 1;
}
.bgsize(@width, @height) {
-moz-background-size: @width @height;
-webkit-background-size: @width @height;
background-size: @width @height;
}
@import "css3.less"
#mybutton {
.background-gradient(#e2e2e2, #b2b2b2);
.uniform-border-radius(5px);
.inset-box-shadow(1px, 2px, 1px, rgba(0, 0, 0, 0.3));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment