Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A very small javascript library that allows you to create browser specific CSS to be merged into your normal classes. No more hacks or mischievous code in your CSS code.
Branch: master


CSS Browser Selector

CSS Browser Selector is a very small javascript which empowers CSS selectors.
You can now write code for: browser, browser version, platform, platform version, device, device version.
Best part: no more hacks; all compliant code.
More info:
beta/experimental versions:

browsers: Firefox; IE; Opera; Safari; Chrome, Konqueror, Iron
browser versions: (most importantly: ie6, ie7, ie8, ie9)
rendering engines: Webkit; Mozilla; Gecko
platforms/OSes: Mac; Win: Win8, Win7, Vista, WinXP, Win2k, WinNT; FreeBSD; Linux/x11
devices: Ipod; Ipad; Iphone; WebTV; Blackberry; Android; J2me; RIM Playbook; mobile (generic)
enabled technology: JS (use in conjunction with <html class="no-js"> for even more granular control)
language detection

Recent contributors to 0.5, 0.6:

more detailed IE detection:

more detailed WIN detection:

no-js to js:
paul irish:

mac versioning

v0.6.1 2012-03-14
iOS version detection
beta: detect if being run in iPad app.

v0.6.0 2012-01-24
more detailed support for Opera, Chrome, Safari (and revised support for Firefox)
versioning for Chrome, Blackberry, Android, Mac
Android device detection
altered how 'mobile' is deterimed to be added to the class string
language detection
RIM Playbook added
continuously evaluates browser max width (in case of resizing)
continuously evaluates browser orientation (portrait vs. landscape)

v0.5.0 2011-08-24
any version of Firefox
more versions of Windows (Win8 [tentative], Win7, Vista, XP, Win2k)
more versions of IE under unique conditions
if "no-js" in HTML class: removes and replaces with "js" (<html class="no-js">)


navigator.userAgent strings:

history of the user agent string:

language list:

windows nt list

blackberry user agent string interpertation:

javascript compression:

screen resolutions:

aspect ratio:

iOS detection?:


Ruby on Rails Plugin by Reid MacDonald

PHP CSS Browser Selector by Bastian Allgeier

Wordpress Plugin by Adrian hanft


<style type="text/css"> 
    .ie .example { background-color: yellow; }
    .ie7 .example { background-color: orange }
    .gecko .example { background-color: gray; }
    .win.gecko .example { background-color: red; }
    .linux.gecko .example { background-color: pink; }
    .opera .example { background-color: green; }
    .konqueror .example { background-color: blue; }
    .webkit .example { background-color: black; }
    .chrome .example { background-color: cyan; }
    .example { width: 100px; height: 100px; }
    .no-js, .no_js, .nojs { display: block; }
    .js { display: none; }



Based on idea by 37signals:

Niyaz (
Marcio Trindade (
rbottarelli (
Bryan Chow (
Derek Lio (
Paul Irish (
Preston Badeer
André Lopes
Tazio Mirandola - copiaincolla pubblicità
Reid MacDonald (
Vinicius Braga (
Chris Preece (
M@ McCray
Daniel Westermann-Clark
Steve Clay (
Jeff Bellsey
Jean Pierre
Micah Snyder
Derek (
Jesse Scott
Moises Kirsch (
Alex Wiltschko
Chris Warren and Tony Nelson (

Something went wrong with that request. Please try again.