Skip to content

Instantly share code, notes, and snippets.

@rezozero
Created October 27, 2012 12:25
Show Gist options
  • Save rezozero/3964476 to your computer and use it in GitHub Desktop.
Save rezozero/3964476 to your computer and use it in GitHub Desktop.
LESS: Mixins
/*
Mixins LESS REZOZERO
*/
// For CSS Matrix images
@icon-size: 30px;
@background-size: @icon-size*20 @icon-size*16;
.matrix-icon() {
background-image: url(../img/[email protected]);
background-repeat: no-repeat;
background-size: @background-size;
.keep-image-aspect();
}
.box-shadow(@x, @y, @width, @color)
{
box-shadow: @x @y @width @color;
-webkit-box-shadow: @x @y @width @color;
-moz-box-shadow: @x @y @width @color;
-o-box-shadow: @x @y @width @color;
-ms-box-shadow: @x @y @width @color;
}
.border-radius( @radius ) {
border-radius: @radius;
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
-o-border-radius: @radius;
-ms-border-radius: @radius;
}
.border-radius( @tlradius, @trradius, @brradius, @blradius ) {
border-radius: @tlradius @trradius @brradius @blradius;
-webkit-border-radius: @tlradius @trradius @brradius @blradius;
-moz-border-radius: @tlradius @trradius @brradius @blradius;
-o-border-radius: @tlradius @trradius @brradius @blradius;
-ms-border-radius: @tlradius @trradius @brradius @blradius;
}
.box-sizing (){
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
-ms-box-sizing: content-box;
box-sizing: content-box;
}
.box-sizing-border (){
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.transition-duration(@ms)
{
transition-duration:@ms;
-webkit-transition-duration:@ms;
-moz-transition-duration:@ms;
-o-transition-duration:@ms;
-ms-transition-duration:@ms;
transition-property: all;
-webkit-transition-property: all;
-moz-transition-property: all;
-o-transition-property: all;
-ms-transition-property: all;
}
.keep-image-aspect(){
image-rendering:optimizeSpeed;             /* Legal fallback                 */
image-rendering:pixellated;         /* Firefox                        */
image-rendering:-o-crisp-edges;            /* Opera                          */
image-rendering:-webkit-optimize-contrast; /* Chrome (and eventually Safari) */
image-rendering:optimize-contrast;         /* CSS3 Proposed                  */
-ms-interpolation-mode:nearest-neighbor;   /* IE8+ */   
}
.touch-scroll(){
-webkit-overflow-scrolling: touch;
}
.color-placeholder ( @color-text-placeholder ) {
input::-webkit-input-placeholder { color: @color-text-placeholder; }
input::-moz-placeholder { color: @color-text-placeholder; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment