DIV+CSS中if条件hack知识

2024-01-18 11:17 小编

1、Css if hack条件语法

<!--[if IE]> Only IE <![endif]-->
仅悉数的WIN细碎自带IE可辨认
<!--[if IE 5.0]> Only IE 5.0 <![endif]-->
只要IE5.0可以或许识别
<!--[if gt IE 5.0]> Only IE 5.0+ <![endif]-->
IE5.0包换IE5.5均或者识别
<!--[if lt IE 6]> Only IE 6- <![endif]-->
仅IE6可识别
<!--[if gte IE 6]> Only IE 6/+ <![endif]-->
IE6以及IE6以下的IE5.x都可辨认

<!--[if lte IE 7]> Only IE 7/- <![endif]-->
仅IE7可辨认
<!--[if gte IE 7]> Only IE 7/+ <![endif]-->
IE7以及IE7以下的IE6、IE5.x都可辨认

<!--[if IE 8]> Only IE 8/- <![endif]-->
仅IE8可识别

2、DIV+CSS实例教程

CSS实例一:
让IE6-IE8浮现不同的内容,DIV CSS代码如下:

 <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DIV IF前提实例WWW.CSS5.COM实例</title>
</head>
<body>
你正在应用:
<!--[if IE 7]> 
<h2>IE7</h2>
<![endif]-->
<!--[if IE 6]> 
<h2>IE6</h2>
<![endif]-->
<!--[if IE 8]> 
<h2>IE8</h2>
<![endif]-->
<br><br>
<strong>CSS5说明</strong>:假如你的涉猎器版本为几何即会显露IE多少,针对IE6-IE8实验CSS教程 
</body>
</html>
 


说明:以上针对分歧IE闪现差距网页内容DIV+CSS实例履行。

DIV+CSS实例二:
让IE6-IE8体现差别CSS格局成果,DIV CSS代码如下:

 <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS IF前提hack实例 css5.com.cn</title>
<!--[if IE 6]> 
<style type="text/css">
.CSS5{ color:#F00;}
</style>
<![endif]-->
<!--[if IE 7]> 
<style type="text/css">
.CSS5{ color:#FF0;}
</style>
<![endif]-->
<!--[if IE 8]> 
<style type="text/css">
.CSS5{ color:#00F;}
</style>
<![endif]-->
</head>
<body>
<div class="CSS5">
DIV CSS执行默示:<br>
我在IE6下是红颜色,在IE7下是黄色彩,在IE8下是蓝颜色
</div>
</body>
</html>


在线咨询 拨打电话

电话

13363039260

内部绝密传真282期

微信二维码