标签:style color 使用 ar strong for div sp 代码
css hack就是针对不同的浏览器写不同的CSS code的过程,就叫CSS hack!
原理:
div{background:green;/*forfirefox*/*background:red;/*forIE6*/(bothIE6&&IE7)}background:orange;*background:blue;background:green!important;background:blue;background:orange;*background:green;区别FF,IE7,IE6:background:orange;*background:green;_background:blue;background:orange;*background:green!important;*background:blue;这种方式是IE浏览器专有的Hack方式,微软官方推荐使用的hack方式。举例如下
只在IE下生效
<!--[if IE]>
这段文字只在IE浏览器显示
<![endif]-->
只在IE6下生效
<!--[if IE 6]>
这段文字只在IE6浏览器显示
<![endif]-->
只在IE6以上版本生效
<!--[if gte IE 6]>
这段文字只在IE6以上(包括)版本IE浏览器显示
<![endif]-->
只在IE8上不生效
<!--[if ! IE 8]>
这段文字在非IE8浏览器显示
<![endif]-->
非IE浏览器生效
<!--[if !IE]>
这段文字只在非IE浏览器显示
<![endif]-->
标签:style color 使用 ar strong for div sp 代码
原文地址:http://www.cnblogs.com/hexiaoli/p/3958712.html