Skip to content

Instantly share code, notes, and snippets.

@bakpa79
Created September 3, 2015 15:29
Show Gist options
  • Save bakpa79/ca274f3d78e620acc8ea to your computer and use it in GitHub Desktop.
Save bakpa79/ca274f3d78e620acc8ea to your computer and use it in GitHub Desktop.
(function() {
var docEl = document.querySelectorAll('html');
docEl[0].setAttribute('data-useragent', navigator.userAgent);
/* IE10 and up no longer use the conditional IE hack - they are supposed to render very closely to what you find in WebkitGecko
But not really. So you still have to write conditional styles.
This is a small script that throws the browser's user-agent string on the <html> element. You can then write styles for thatt particular browser rendering.
For IE 10, 11, you use part of the string in your css to target the style declaration. NOTE: IE11's string is actually 'Trident/7.0'
html[data-useragent*='MSIE 10.0'], html[data-useragent*='Trident/7.0']{ ....Style Here....}
*/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment