IE6,IE7,IE8 CSS hacks 演示之 检测当前浏览器版本

这个样例比较系统的将IE6,IE7,IE8 CSS hacks方法应用出来。
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<title>CSS hacks for IE6, IE7, IE8</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
body {font: 28px/1 Arial, Tahoma, sans-serif; color: #666; padding: 20px;}
strong {color: #390}
h1 {font-size: 16px; font-weight: normal; margin: 80px 0}
#ie6, #ie7, #ie8 {display: none}
/* IE 6 */
* html #notie {display: none}
* html #ie6 {display: block}
/* IE 7 */
*+html #notie {display: none}
*+html #ie7 {display: block}
/* IE 8 */
#notie {display: none\0/}
#ie8 {display: block\0/}
/*]]>*/
</style>
</head>
<body>
<div id="notie">你的浏览器版本: <strong>非IE</strong></div>
<div id="ie6">你的浏览器版本: <strong>Internet Explorer 6</strong></div>
<div id="ie7">你的浏览器版本: <strong>Internet Explorer 7</strong></div>
<div id="ie8">你的浏览器版本: <strong>Internet Explorer 8</strong></div>
</body>
</html>

你可能感兴趣的:(IE6,IE7,IE8 CSS hacks 演示之 检测当前浏览器版本)