From 31bdbe815bcf9c881569c7f2a48c8a5704807b13 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Fri, 17 Jul 2009 20:57:23 -0500 Subject: [PATCH] [Compass Core] New mixin: +opacity(amount). Provides cross-browser css opacity. Amount should be between 0 and 1, where 0 is transparent and 1 is opaque. --- .../stylesheets/compass/utilities/_general.sass | 1 + .../compass/utilities/general/_opacity.sass | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_general.sass b/frameworks/compass/stylesheets/compass/utilities/_general.sass index a09b235a..8e593fec 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_general.sass +++ b/frameworks/compass/stylesheets/compass/utilities/_general.sass @@ -4,3 +4,4 @@ @import general/tag_cloud.sass @import general/inline_block.sass @import general/hacks.sass +@import general/opacity.sass \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass b/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass new file mode 100644 index 00000000..04b85ec4 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass @@ -0,0 +1,15 @@ +// expects a number from 0 to 1 +=opacity(!opacity = 1) + :opacity= !opacity + :-moz-opacity= !opacity + :-khtml-opacity= !opacity + :-ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + round(!opacity*100) + ")" + :filter= "alpha(opacity=" + round(!opacity*100) + ")" + +// Make an element completely transparent. +=transparent + +opacity(0) + +// Make an element completely opaque. +=opaque + +opacity(1)