今天为大家讲解div+css中if条件hack知识与教程实例,各位朋友可以借鉴一下我们的这个例子。希望下面的案列对你有所帮助。
IE的CSS if条件Hack- css hack
为大家讲解DIV+CSS中if条件hack知识与教程实例
目录
Css if hack条件语法
立即学习“前端免费学习笔记(深入)”;
DIV+CSS if实例
if条件hack总结
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条件实例</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>说明</strong>:如果你的浏览器版本为多少即会显示IE多少,针对IE6-IE8实验CSS教程
</body>
</html>
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实例 </title>
<!--[if IE 6]>
<style type="text/css">
.div{ color:#F00;}
</style>
<![endif]-->
<!--[if IE 7]>
<style type="text/css">
.div{ color:#FF0;}
</style>
<![endif]-->
<!--[if IE 8]>
<style type="text/css">
.div{ color:#00F;}
</style>
<![endif]-->
</head>
<body>
<div class="div">
DIV CSS实验提示:<br>
我在IE6下是红颜色,在IE7下是黄颜色,在IE8下是蓝颜色
</div>
</body>
</html>说明:以上实验仅实验IE6-IE8下if HACK。更多精彩请关注php中文网其它相关文章!
相关阅读:
以上就是CSS里的if条件hack怎么写的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号