Skip to content

Instantly share code, notes, and snippets.

@jeffskelton3
Created June 18, 2015 03:08
Show Gist options
  • Save jeffskelton3/da3c75209daea939e89c to your computer and use it in GitHub Desktop.
Save jeffskelton3/da3c75209daea939e89c to your computer and use it in GitHub Desktop.
LESS opacity function
/*
description - a cross browser opactity function
usage example:
.my-class{
.opacity(.50);
}
@param: amount - expects a floating point decimal.
*/
.opacity(@amount){
@whole-number-amount : @amount * 10; //convert from decimal to whole
zoom:1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=@{whole-number-amount})";
filter: alpha(opacity=@whole-number-amount);
-moz-opacity:@amount;
-khtml-opacity: @amount;
opacity: @amount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment