斷定IE 使用 css

全部IE都起做用:css

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

IE之外瀏覽器起做用:html

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

只有IE7起做用:瀏覽器

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

只有IE6起做用:網絡

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

只有IE5起做用:網站

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

只有IE5.5起做用:google

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

只對IE6及如下版本起做用:code

<!--[if lt IE 7]>  <link rel="stylesheet" type="text/css" href="ie6-and-down.css"/> <![endif]-->
<!--[if lte IE 6]>  <link rel="stylesheet" type="text/css" href="ie6-and-down.css"/> <![endif]-->

只對IE7及如下版本起做用:htm

<!--[if lt IE 8]>  <link rel="stylesheet" type="text/css" href="ie7-and-down.css"/> <![endif]-->
<!--[if lte IE 7]>  <link rel="stylesheet" type="text/css" href="ie7-and-down.css"/> <![endif]-->

只對IE8及如下版本起做用:io

<!--[if lt IE 9]>  <link rel="stylesheet" type="text/css" href="ie8-and-down.css"/> <![endif]-->
<!--[if lte IE 8]>  <link rel="stylesheet" type="text/css" href="ie8-and-down.css"/> <![endif]-->

只對IE6及以上版本起做用:file

<!--[if gt IE 5.5]>  <link rel="stylesheet" type="text/css" href="ie6-and-up.css"/> <![endif]-->
<!--[if gte IE 6]>  <link rel="stylesheet" type="text/css" href="ie6-and-up.css"/> <![endif]-->

只對IE7及以上版本起做用:

<!--[if gt IE 6]>  <link rel="stylesheet" type="text/css" href="ie7-and-up.css"/> <![endif]-->
<!--[if gte IE 7]>  <link rel="stylesheet" type="text/css" href="ie7-and-up.css"/> <![endif]-->

只對IE8及以上版本起做用:

<!--[if gt IE 7]>  <link rel="stylesheet" type="text/css" href="ie8-and-up.css"/> <![endif]-->
<!--[if gte IE 8]>  <link rel="stylesheet" type="text/css" href="ie8-and-up.css"/> <![endif]-->

3、一般對IE6作這樣處理:
(本站就是這樣處理)
對於IE6及如下版本處理是很具備挑戰性.近來,人們都在呼籲對IE6要太在乎,包括一些企業,一些網絡應用,甚至是政府。如今有一個比讓這些在 IE6下讓人慘忍睹網站下地域更好解決方案,那就是單獨寫一個針對IE6精簡CSS樣式表,這樣至少會影響人們瀏覽網頁主要內容。而後再寫一個IE6以上版本及其它瀏覽器正常CSS,這樣是很好?

<!--[if !IE 6]><!-->   <link rel="stylesheet" type="text/css" media="screen, projection" href="REGULAR-STYLESHEET.css" /> <!--<![endif]--> 
<!--[if gte IE 7]> <link rel="stylesheet" type="text/css" media="screen, projection" href="REGULAR-STYLESHEET.css" /> <![endif]-->
<!--[if lte IE 6]> <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" /> <![endif]-->

4、若是你非要用HACK來解決話……請往下看
只對IE7起做用:

* html #div {     height: 300px; }

對非IE7起做用:

#div {     _height: 300px; }

只對IE6以上版本起做用:

#div {    height/**/: 300px; }
html->body #div {       height: 300px; }
相關文章
相關標籤/搜索