CSS Browser Selector
Clever technique to help you on CSS hacks.
CSS Browser Selector is a very small javascript with just one line which empower CSS selectors. It gives you the ability to write specific CSS code for each operating system and each browser.Download the CSS Browser Selector javascript file from following link.
http://github.com/rafaelp/css_browser_selector/raw/master/css_browser_selector.js
And here's usage of the file.
Copy and paste bellow line inside head section of your document.
<script src="css_browser_selector.js" type="text/javascript"></script>
Set CSS attributes with the code of each Browser/OS you want to hack as given bellow example.
- html.gecko div#header { margin: 1em; }
- .opera #header { margin: 1.2em; }
- .ie .mylink { font-weight: bold; }
- .mac.ie .mylink { font-weight: bold; }
- .[os].[browser] .mylink { font-weight: bold; } -> without space between .[os] and .[browser]
Available OS Codes [os]:
- win - Microsoft Windows (all versions)
- vista - Microsoft Windows Vista new
- linux - Linux (x11 and linux)
- mac - Mac OS
- freebsd - FreeBSD
- ipod - iPod Touch
- iphone - iPhone
- ipad - iPad new
- webtv - WebTV
- j2me - J2ME Devices (ex: Opera mini) changed from mobile to j2me
- blackberry - BlackBerry new
- android - Google Android new
- mobile - All mobile devices new
Available Browser Codes [browser]:
- ie - Internet Explorer (All versions)
- ie8 - Internet Explorer 8.x
- ie7 - Internet Explorer 7.x
- ie6 - Internet Explorer 6.x
- ie5 - Internet Explorer 5.x
- gecko - Mozilla, Firefox (all versions), Camino
- ff2 - Firefox 2
- ff3 - Firefox 3
- ff3_5 - Firefox 3.5
- ff3_6 - Firefox 3.6 new
- opera - Opera (All versions)
- opera8 - Opera 8.x
- opera9 - Opera 9.x
- opera10 - Opera 10.x
- konqueror - Konqueror
- webkit or safari - Safari, NetNewsWire, OmniWeb, Shiira, Google Chrome
- safari3 - Safari 3.x
- chrome - Google Chrome
- iron - SRWare Iron
Comments
Post a Comment