Skip to content

Instantly share code, notes, and snippets.

@byrichardpowell
Created August 25, 2012 15:52
Show Gist options
  • Save byrichardpowell/3467313 to your computer and use it in GitHub Desktop.
Save byrichardpowell/3467313 to your computer and use it in GitHub Desktop.
Make prefixes less painful using a preprocessor
/* helpers.less */
.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);
-o-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
-ms-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
}
/* site.less */
@import 'helpers.less';
.box-modal { .shadow(0, 0, 5px, 0.5); }
/* site.css */
.box-modal { -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
-o-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
-ms-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment