开发者

I want to apply javascript and CSS to all browser but not to IE6 is it possible?

I want to apply javascript and CSS to all browser but not to IE6 is it possible?

for example I have a javascript abc.js

I want to use this javascript in all browser IE7, IE8, IE9, Firefox, Safari, Chrome.

But i don't want to use this jav开发者_如何学Pythonascript in IE6.


This should be possible using a combination of conditional comments.

You'd have to specify things twice but otherwise, this should work:

<!--[if gt IE 6]>
   For Internet Explorer > 6
<![endif]-->

<![if !IE]>
 For all other browsers 
<![endif]>


supero hide all your other stylesheets from Internet Explorer 6, wrap them inside this Conditional Comment.

<!--[if ! lte IE 6]><!-->
/* Stylesheets for browsers other than Internet Explorer 6 */
<!--<![endif]-->

Then add the Universal Internet Explorer 6 stylesheet.

<!--[if lte IE 6]>
<link rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.1.1.css" media="screen, projection">
<![endif]--> 


Andy Clarke has the answer in his Universal IE6 CSS project. I recommend the article on his 'For a beautiful web' site, as he has a specific approach to just this problem - which may or may not be for the same reasons you wish to carry out this ie6 only favouritism!

From his Universal IE6 CSS code:

To hide all your other stylesheets from Internet Explorer 6, wrap them inside this Conditional Comment.

<!--[if ! lte IE 6]><!-->
/* Stylesheets for browsers other than Internet Explorer 6 */
<!--<![endif]-->

Then add the Universal Internet Explorer 6 stylesheet.

<!--[if lte IE 6]>
<link rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.1.1.css" media="screen, projection">
<![endif]--> 

See below for the full article, and the links within it for the full code: http://forabeautifulweb.com/blog/about/universal_internet_explorer_6_css


You can use conditional comments to do stuff by excluding IE 6 or lower.

<![if gt IE 6]>
Markup used by IE 7, 8 and above, and all other browsers ignoring these proprietary tags...
<![endif]>

That's the "Downlevel-revealed Conditional Comments".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜