Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save visualjazz-egargalicano/6546079 to your computer and use it in GitHub Desktop.

Select an option

Save visualjazz-egargalicano/6546079 to your computer and use it in GitHub Desktop.

An Anonymous Pen

Uses a technique in which you could target any browser by User Agent string. Which should be way last resort.

A Pen by Captain Anonymous on CodePen.

License.

<h1>I'll be blue in IE 10 and black in everything else.</h1>
var b = document.documentElement;
b.setAttribute('data-useragent', navigator.userAgent);
b.setAttribute('data-platform', navigator.platform );
// IE 10 == Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
html[data-useragent*='MSIE 10.0'] h1 {
color: blue;
}
h1 {
text-align: center;
padding: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment