Return to Snippet

Revision: 51275
at September 20, 2011 03:40 by reverend

Initial Code
  var b = document.documentElement;
  b.setAttribute('data-useragent',  navigator.userAgent);
  b.setAttribute('data-platform', navigator.platform );

Initial URL

Initial Description
Will produce output like this:



Target in CSS like this:

html[data-useragent*='Chrome/13.0'] .nav {background:url(img/radial_grad.png) center bottom no-repeat;}


html[data-useragent*='Chrome/13.0'][data-platform='Win32'] {}

or iPad only

Initial Title
Target specific browsers in CSS with JS

Initial Tags
css, js, browser

Initial Language