Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any equivalent to IE conditional comment for chrome and safari?

I am wondering if there is any thing which works like ie conditional comment for webkit.

I want to change width.

For example,

<!--[if IE]>
<link href="css/ie.css" rel="stylesheet" type="text/css" />
<![endif]-->

Thanks in advance.

like image 491
shin Avatar asked Jan 12 '10 20:01

shin


2 Answers

No, there are not.

You can hack it by doing browser detection in JS and attaching scripts/styles dynamically.

Or, if you are concerned only with having different css for different browsers, you can use css hacks. There are probably css hacks that work with the browsers you need.

Or, if the only thing you need to change is 'width' (of one css definition?) you can probably do it in jquery or javascript

jquery browser detection. see: http://docs.jquery.com/Utilities/jQuery.browser

like image 132
mkoryak Avatar answered Sep 19 '22 02:09

mkoryak


I use this on every project: http://rafael.adm.br/css_browser_selector/

Although, if you are having to do a lot of targeting in Firefox or Webkit — you may want to reconsider how you are writing your HTML/CSS.

like image 32
scott Avatar answered Sep 20 '22 02:09

scott