css hack 方法总汇1

hack方法与haslayout的区别
   hack是针对IE不同版本间的兼容方法
   haslayout是针对IE浏览器特有的属性,为了兼容IE与不同浏览器间的样式

 
hack方法
1    IE条件注释法
          只在IE下生效
            <! --[if IE]>  <link style="text/css" rel="stylesheet"  href="" /> <! [endif] -->
        如果想针对某个版本范围内的IE进hack,可以结合 关键字 lte, lt,  gte,  gt, !进行注释 ,其中lte  :表示  小于等于。lt :表示 小于
        gte :表示  大于等于 。  gt  表示  :  大于 。  !  表示:  不等于。
 
        例:<! --[if gt IE  6]><link href="" type="text/css"  rel="stylesheet"  > <!  [endif]-->  //外链样式表    注意 !  与--这间有空格间隔
            另外一种形式:
                <! --[if IE  6]>
                        <style type="text/css"></style>        //内嵌样式表
                <! [endif] -->
            还可以写JS 的hack
            <! --[if IE 6]>
                    <script type="text/javascript"></script>
 
            <! [endif] -->
        
 
2   选择符前缀法
          *html  ...{}  IE6  有效   
        *+html  ...{}   IE7 有效 
 
         只能在CSS样式文件或内嵌式的style中这样写,不能用于行内式
3    属性前缀法
      style="_200px" IE6
       style="*200px"   IE7
        或者在CSS文件中写这样的样式,也是可以的
 
原文地址:https://www.cnblogs.com/soofly/p/3460798.html