Reputation: 811
I want to use fonts on my website which look great in Firefox, but broken up on Chrome and IE. Now to avoid this issue I wanted to change the font family for only Chrome and IE. There is the [if IE] statement for IE support, but is there one for Chrome (and possibly more browsers), too?
Upvotes: 0
Views: 1882
Reputation: 133
Simple solution, just use this JS library and you can easily apply styles for every browser/os combination:
With this you will get a class name on the body tag with the current name and version of the browser also with the used OS.
After include the file:
<script src="js/browserclass.js"></script>
For example on Windows 8.1 with the latest chrome you will see:
<body class="chrome chrome34 win desktop">
And in your style file you can refer by: (.sass styling)
body.chrome
#example
color: blue
or
body.win.chrome
#example
color: red
Note:
[if IE] statements deprecated since IE10 so this is the solution for that
Upvotes: 2
Reputation: 9949
This site is very helpful
http://paulirish.com/2009/browser-specific-css-hacks/
Upvotes: 0
Reputation: 5565
Available flags are:
Use Example:
if ($.browser.webkit) {
alert( "Set up your font css" );
}
Upvotes: 4
Reputation: 324820
No, only IE supports conditional comments.
However, I would advise against any browser-specific code. As a developer it's up to you to ensure your site looks equally good in as many browsers as possible.
If you really want conditional code, use browser detection (ie. search the user agent string for fragments that identify the browser)
Upvotes: 3