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

本文提供了一个关于如何针对不同版本的Internet Explorer浏览器(IE6、IE7、IE8)应用特定CSS样式的技术实例。通过使用特定的CSS hack方法,可以实现对不同IE版本的支持与兼容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这个样例比较系统的将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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值