Skip to content

Instantly share code, notes, and snippets.

@thealscott
Created July 9, 2012 14:12
Show Gist options
  • Save thealscott/3076810 to your computer and use it in GitHub Desktop.
Save thealscott/3076810 to your computer and use it in GitHub Desktop.
SCSS utility mixins; includes custom font, box-sizing, opacity, border-radius and box-shadow mixins with prefixes and polyfills.
@mixin custom-font($name, $weight, $font_type) {
$fallbacks:Helvetica, Arial, sans-serif;
@if $font_type == serif {
$fallbacks:Georgia, "Times New Roman", serif;
}
font-family: '#{$name} #{$weight}', $fallbacks;
font-weight:$weight;
}
@mixin box-sizing($value) {
box-sizing:$value;
-moz-box-sizing:$value; /* Firefox */
-webkit-box-sizing:$value; /* Safari */
.ie7 &{
behavior: url(/assets/js/lib/boxsizing.htc);
}
}
@mixin opacity($value) {
-moz-opacity:$value;
-webkit-opacity:$value;
opacity:$value;
$ms_value:$value * 100;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=#{$ms_value})"; /* for IE8 in IE7 mode */
filter: alpha(opacity=$ms_value); /* for IE6-IE8 */
}
@mixin box-shadow($parameters) {
-webkit-box-shadow: $parameters;
-moz-box-shadow: $parameters;
box-shadow: $parameters;
.ie8 &,
.ie7 &{
behavior: url(/assets/js/lib/PIE.htc);
}
}
@mixin border-radius($parameters) {
-webkit-border-radius: $parameters;
-moz-border-radius: $parameters;
border-radius: $parameters;
.ie8 &,
.ie7 &{
behavior: url(/assets/js/lib/PIE.htc);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment