<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml><card  id="index"  title="驽鸟公寓  &raquo; Blog Archive  IE8 Beta1、IE7、IE6、Firefox2.0.0.12的一些CSS HACK测试 | 驽鸟公寓"  ><p>
			标题：IE8 Beta1、IE7、IE6、Firefox2.0.0.12的一些CSS HACK测试<br/>
			时间：2008-04-08 (9:39 上午)<br/>
			分类：<a href="index-wap.php?cat=9" title="View all posts in 电脑网络" >电脑网络</a><br/>
            标签：<a href="index-wap.php?tag=css">CSS</a>, <a href="index-wap.php?tag=css-hack">CSS hack</a><br/>
			作者：驽鸟<br/> 
            <br/>
            对IE8、IE7、IE6、Firefox2.0.0.12做了简单的一些CSS HACK测试。下文中的 IE8 暂时仅代表IE8 beta1)。
CSS定义：p {color:#f00;}
xhtml结构：&#60;p&#62;文字&#60;/p&#62;
主要是测试&#8220;文字&#8221;这个颜色在不同浏览器下使用hack的一些结果报告：


    
        
            
            * html&#160;p {color:#f00;}
            
            
            支持 IE6
            
            
            不支持FF IE7 IE8b1
            
        
        
            
            *+html p {color:#f00;}
            
            
            支持 IE7 IE8b1
            
            
            不支持FF IE6
            
        
        
            
            p {*color:#f00;}
            
            
            支持 IE7 IE6
            
            
            不支持FF IE8b1
            
        
    


相关测试：


    
        
            
            p {+color:#f00;}
            
            
            支持IE7 IE6
            
            
            不支持FF IE8b1
            
        
        
            
            p {_color:#f00;}
            
            
            支持IE6
            
            
            不支持FF
            
        
        
            
            p {color:#00f !important;}
            p {color:#f00;}
            
            
            支持IE6 IE7 IE8b1 FF
            
            
            &#160;
            
        
        
            
            p {color:#00f !important;color:#f00;}
            
            
            支持IE7 IE8b1 FF
            
            
            不支持IE6
            
        
        
            
            head:first-child+body p {color:#f00;}
            
            
            支持IE7 IE8b1 FF
            
            
            不支持IE6
            
        
        
            
            /**//*/
            p {color:#f00;}
            /**/
            
            
            支持IE8b1
            
            
            不支持IE6 IE7 FF
            
        
        
            
            html*p {color:#f00;}
            
            
            支持IE6 IE7
            
            
            不支持IE8b1 FF
            
        
        
            
            body&#62;p {color:#f00;}
            
            
            支持IE7 IE8b1 FF
            
            
            不支持IE6
            
        
        
            
            html[xmlns] p {color:#f00;}
            
            
            支持IE7 IE8b1 FF
            
            
            不支持IE6
            
        
        
            
            @import &#8216;style.css&#8217;;
            @import &#8220;style.css&#8221;;
            @import url(style.css);
            @import url(&#8216;style.css&#8217;);
            @import url(&#8220;style.css&#8221;);
            
            
            支持IE6 IE7 IE8b1 FF
            
            
            &#160;
            
        
        
            
            P {/*/*color:#f00;/* */}
            
            
            支持IE6 IE7 FF
            
            
            不支持IE8b1
            
        
    


&#160;
IE8 中增加了 CSS3 中的子串匹配的属性选择器（substring matching attribute selectors），具体规则与正则中的匹配很相似：
E[att^=&#8217;val&#8217;] //子串以&#8217;val&#8217; 开始
E[att$=&#8217;val&#8217;] //子串以&#8217;val&#8217; 结束
E[att*=&#8217;val&#8217;] //子串中包含&#8217;val&#8217;
IE8 支持绝大多数基本的 CSS2.1 选择器，不支持的包括但不限于：[:first-line] 、[:first-letter]。
对于 CSS2.1 中的 generated content 部分，即通过使用伪元素 :before 和 :after 添加文本内容，IE8 中支持 并未完全 。
而对于几乎在其他浏览器中都支持的 opacity 和 RGBA ，IE8 中依旧没有支持。
对于原来用来区分 IE 的 HACK 在 IE8 中基本失效（比如*property:value、*property:value等）。
原有 IE 的 list-item whitespace bug 在 IE8 中依旧存在。
原有 IE 的 z-index bug 在 IE8 中依旧存在。
IE8 中产生新的 bug：当 line-heigth 小于正常值时，超出的部分将被裁切掉。
IE8 中依然不支持 display:table 。
IE8 中依然不支持 border 的 transparent 值。
IE8 中 @import 只支持三层嵌套。
IE8中 border的 transparent 不被支持
IE8中产生新的BUG：line-heigth BUG
/*/p{ color:#1e90ff}/*/　只针对IE8的hack，可以是属性也可以是类
            <br/>	
            <span class="stamp">上一篇：</span><a href="index-wap.php?p=193">光盘自动播放的功能如何实现？</a><br/>            <span class="stamp">下一篇：</span><a href="index-wap.php?p=191">50个求婚的理由</a><br/>    
                        
			<br/><a href="index-wap.php">返回首页</a>
<br/>切换访问：<a href="index-wap2.php">2.0版</a> | 1.1版
</p></card></wml>