0

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?

4 Answers 4

4

jQuery.browser

Available flags are:

  • List item
  • webkit (as of jQuery 1.4)
  • safari (deprecated)
  • opera
  • msie
  • mozilla

Use Example:

 if ($.browser.webkit) { alert( "Set up your font css" ); } 
Sign up to request clarification or add additional context in comments.

Comments

3

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)

Comments

2

Simple solution, just use this JS library and you can easily apply styles for every browser/os combination:

BrowserClass.js

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

Comments

0

This site is very helpful

http://paulirish.com/2009/browser-specific-css-hacks/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.