CSS hide and show

1. IE<=6/Win 不识别CSS2高级选择器(IE5/MAC支持)

1 .buggybox {height: 1%;}  /* for all browser */
2 #parentElement>.buggybox {height: auto;} /* fix for browser except IE<=6/Win */

 

2. 只有IE<=6/Win,IE/MAC识别* html选择器   &&   MAC-hack

1 /* Hides from IE5-mac \*/
2 * html .buggybox {height: 1%;}  /* just for IE<=6/Win */
3 /* End hide from IE5-mac */

  加粗的'\'在IE/MAC下会转义‘*’,因此整个规则就不适用IE/MAC,称为MAC-hack

 

3. IE<6/Win (Opera<7)遇到不能解析的CSS属性时会发生解析bug,停止解析本选择器余下属性

1 div.content { 
2     width:400px; 
3     voice-family: "\"}\""; 
4     voice-family:inherit;
5     width:300px;
6   } 

 

4. CSS Hack

1 .select {
2 
3   background-color:red\0;  /* ie 8/9 */
5   background-color:blue\9\0;  /* ie 9 */
6   *background-color:#dddd00;  /* ie 7 */
7   _background-color:#CDCDCD;  /* ie 6 */
8 } /* 注意hack顺序 */

      "*"   可以识别IE6、IE7

      "_"   可以识别IE6

  

  

posted on 2013-04-24 21:45  BigPalm  阅读(389)  评论(0编辑  收藏  举报

导航