CSS for different browsers 07-15-2013, 05:59 PM
#1
This is the piece of code I wrote and I would like to share with you guys. 
It shows how to load different stylesheets depending on the browser that the user is currently browsing, in order to be able to conduct a simple and efficient crossbrowser. We’ll use the jQuery JavaScript library.
The code checks whether the browser is IE (msie). If not, they test to see if it's Firefox, and if you're not, the same applies the stylesheet related to Chrome.
It is very useful for mobile coding too.
Hope you liked it!

It shows how to load different stylesheets depending on the browser that the user is currently browsing, in order to be able to conduct a simple and efficient crossbrowser. We’ll use the jQuery JavaScript library.
The code checks whether the browser is IE (msie). If not, they test to see if it's Firefox, and if you're not, the same applies the stylesheet related to Chrome.
It is very useful for mobile coding too.
Code:
<script type="text/javascript">
$(document).ready(function() {
if($.browser.msie){
$("head").append("<link>");
css = $("head").children(":last");
css.attr({
rel: "stylesheet",
type: "text/css",
href: "http://www.yoursite.com/css/style_explorer.css"
});
}
else if ($.browser.mozilla){
$("head").append("<link>");
css = $("head").children(":last");
css.attr({
rel: "stylesheet",
type: "text/css",
href: "http://www.yoursite.com/css/style_firefox.css"
});
}
else{
$("head").append("<link>");
css = $("head").children(":last");
css.attr({
rel: "stylesheet",
type: "text/css",
href: "http://www.yoursite.com/css/style_chrome.css"
});
}
)};
</script>Hope you liked it!
Yar-har Fiddle-dee-dee, being a pirate is alright to be! Do what you want cause a pirate is free, you are a pirate! AHOY!
![[Image: tumblr_m7isvt2N171ranhnao1_500.gif]](http://25.media.tumblr.com/tumblr_m7isvt2N171ranhnao1_500.gif)


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)


![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)