Created
January 25, 2016 17:44
-
-
Save evanre/13b236b23f8efbc0be7e to your computer and use it in GitHub Desktop.
Browser and Device specific CSS styles with SASS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.documentElement.setAttribute("data-browser", navigator.userAgent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Examples | |
// Full list of user-agents - https://user-agents.me/ | |
// @include browser("MSIE 11") {} | |
// @include browser("Android 4.0" "Android 4.1" "Android 4.3") {} | |
// @include browser("iPad" "iPod" "iPhone") {} | |
@mixin browser($browsers: Mozilla) { | |
@each $browser in $browsers { | |
html[data-browser*="#{$browser}"] & { | |
@content; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, don't see any reasons it shouldn't work. The website from comments is dead, but you can google the list of user agents easily.