[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.
This commit is contained in:
Brandon Mathis 2009-07-17 20:57:23 -05:00 committed by Chris Eppstein
parent dafbd88588
commit 31bdbe815b
2 changed files with 16 additions and 0 deletions

View File

@ -4,3 +4,4 @@
@import general/tag_cloud.sass @import general/tag_cloud.sass
@import general/inline_block.sass @import general/inline_block.sass
@import general/hacks.sass @import general/hacks.sass
@import general/opacity.sass

View File

@ -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)