簡體   English   中英

我想將javascript和CSS應用於所有瀏覽器,但不應用於IE6,這可能嗎?

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

我想將javascript和CSS應用於所有瀏覽器,但不應用於IE6,這可能嗎?

例如我有一個javascript abc.js

我想在所有瀏覽器IE7,IE8,IE9,Firefox,Safari,Chrome中使用此javascript。

但我不想在IE6中使用此javascript。

這可以通過結合條件注釋來實現

您必須指定兩次,否則應該可以:

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

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

supero從Internet Explorer 6中隱藏所有其他樣式表,將它們包裝在此“條件注釋”中。

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

然后添加通用Internet Explorer 6樣式表。

<!--[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)在他的Universal IE6 CSS項目中找到了答案。 我建議在他的“為一個美麗的網站”網站上發表該文章,因為他對這個問題有一種特定的解決方法-出於或可能出於您希望進行此收藏的相同原因!

從他的通用IE6 CSS代碼中:

要從Internet Explorer 6中隱藏所有其他樣式表,請將其包裝在此條件注釋中。

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

然后添加通用Internet Explorer 6樣式表。

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

請參閱下面的完整文章,以及其中的完整代碼鏈接: http : //forabeautifulweb.com/blog/about/universal_internet_explorer_6_css

您可以通過排除IE 6或更低版本來使用條件注釋來完成工作。

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

這就是“公開的條件注釋”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM