Skip to content

Instantly share code, notes, and snippets.

@taupecat
Last active October 12, 2015 21:38
Show Gist options
  • Save taupecat/4090271 to your computer and use it in GitHub Desktop.
Save taupecat/4090271 to your computer and use it in GitHub Desktop.
Use Sass to compensate for deficiencies detected by Modernizr.js
// For example, use "no-cssanimations" for a browser that lacks CSS3 animation support
@mixin modernizr($test) {
html.#{$test} & {
@content;
}
}
@taupecat
Copy link
Author

Usage:

.selector {
    left: 0;

    @include modernizr(no-cssanimations) { left: 400px; }
}

Compiles to:

.selector {
    left: 0;
}

html.no-cssanimations .selector {
    left: 400px;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment