Created
June 6, 2011 21:02
-
-
Save yannmadeleine/1011093 to your computer and use it in GitHub Desktop.
basic functions for less
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
//note that in less php all ,(comma) in functions and call must be replaced by ;(semi-colon) see : http://leafo.net/lessphp/docs/#args | |
//handling vendor extension | |
.border-radius(@radius_tl: 5px, @radius_tr: 5px, @radius_br: 5px, @radius_bl: 5px) { | |
border-radius: @arguments; | |
-webkit-border-radius: @arguments; | |
-moz-border-radius: @arguments; | |
} | |
.top-border-radius (@radius: 5px) { | |
border-radius: @radius @radius 0 0; | |
-webkit-border-radius: @radius @radius 0 0; | |
-moz-border-radius: @radius @radius 0 0; | |
} | |
.box-shadow (@x: 0, @y: 0, @blur: 5px, @color: #cebdb2, @opacity : 0) { | |
box-shadow: @x @y @blur fadeout(@color, @opacity); | |
-moz-box-shadow: @x @y @blur fadeout(@color, @opacity); | |
-webkit-box-shadow: @x @y @blur fadeout(@color, @opacity); | |
.pie; | |
} | |
.horizontal_gradient (@start , @end) { | |
background: @start;/* Old browsers */ | |
background: -moz-linear-gradient(top, @start 0%, @end 100%); /* FF3.6+ */ | |
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(100%,@end));/* Chrome,Safari4+ */ | |
background: -webkit-linear-gradient(top, @start 0%,@end 100%);/* Chrome10+,Safari5.1+ */ | |
background: -o-linear-gradient(top, @start 0%,@end 100%); /* Opera11.10+ */ | |
background: -ms-linear-gradient(top, @start 0%,@end 100%); /* IE10+ */ | |
-pie-background: linear-gradient(@start, @end);/* IE6-9 */ | |
background: linear-gradient(top, @start 0%,@end 100%);/* W3C */ | |
.pie | |
} | |
.background_image(@url,@repeat:'no-repeat',@position:'left top'){ | |
background-image:url(@url); | |
background-repeat : @repeat; | |
background-position: @position; | |
} | |
//generic functions | |
.center-vh(@min-height,@ratio:2.57){ | |
font-size: @min-height / @ratio; | |
min-height: @min-height; | |
line-height: @min-height; | |
text-align: center; | |
vertical-align:middle; | |
} | |
//use () to hide from final css | |
.pie() { | |
behavior: url(/PIE.htc); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment