Skip to content

Instantly share code, notes, and snippets.

@opi
Created April 20, 2012 15:04
Show Gist options
  • Save opi/2429422 to your computer and use it in GitHub Desktop.
Save opi/2429422 to your computer and use it in GitHub Desktop.
function.css.less
.rounded(@radius: 0) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
.border-radius(@topright: 0; @bottomright: 0; @bottomleft: 0; @topleft: 0) {
-webkit-border-top-right-radius: @topright;
-webkit-border-bottom-right-radius: @bottomright;
-webkit-border-bottom-left-radius: @bottomleft;
-webkit-border-top-left-radius: @topleft;
-moz-border-radius-topright: @topright;
-moz-border-radius-bottomright: @bottomright;
-moz-border-radius-bottomleft: @bottomleft;
-moz-border-radius-topleft: @topleft;
border-top-right-radius: @topright;
border-bottom-right-radius: @bottomright;
border-bottom-left-radius: @bottomleft;
border-top-left-radius: @topleft;
}
.opacity(@opacity: 0.5) {
-moz-opacity: @opacity;
-khtml-opacity: @opacity;
-webkit-opacity: @opacity;
opacity: @opacity;
}
/*Shadow*/
.drop-shadow(@x-axis: 0; @y-axis: 1px; @blur: 2px; @alpha: 0.1) {
-webkit-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
-moz-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
}
.inner-shadow(@horizontal:0; @vertical:1px; @blur:2px; @alpha: 0.4) {
-webkit-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
-moz-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
}
.box-shadow(@arguments) {
-webkit-box-shadow: @arguments;
-moz-box-shadow: @arguments;
box-shadow: @arguments;
}
/*Gradient*/
.gradient(@color: #F5F5F5; @start: #EEE; @stop: #FFF) {
background: @color;
background: -webkit-gradient(linear,
left bottom,
left top,
@start,
@stop);
background: -moz-linear-gradient(center bottom,
@start 0%,
@stop 100%);
}
/*Transition*/
.transition(@effect:all; @duration:0.2s; @ease:ease-out) {
-webkit-transition: @effect @duration @ease;
-moz-transition: @effect @duration @ease;
transition: @effect @duration @ease;
}
/*Scale*/
.scale(@ratio:1.5){
-webkit-transform:scale(@ratio);
-moz-transform:scale(@ratio);
transform:scale(@ratio);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment