CSS Hack

on Thursday, February 12th, 2009 at 2:04 pm by 阿辛
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#demo {
    color:red; /*All*/
    color:red\9;/*All IE*/
    color:red\0;/*IE8 only*/
    +color:blue; /*IE6, IE7 还能用 * 或者 # */
    _color:green; /*IE 6*/
    [;background-color: green;] /*safari, chrome*/
}
 
* html #demo { /*IE 6 and below*/ }
 
*+html #demo { /*IE 7, IE 8 beta*/ }
 
@media all and (min-width:0px){
    #demo { /*Opera*/ }
}
 
/*\*//*/
#demo { /*IE 8 beta*/ }
/**/
 
@media screen and (-webkit-min-device-pixel-ratio:0) {
    #demo {/* 针对Chrome、Safari 3.0、Opera 9 的CSS样式 */}
} 
 
body:nth-of-type(1) #demo {
   /*Chrome & Safari 3.1*/
}
 
.className, x:-moz-any-link { /*FireFox 2 */ } 
 
.className, x:-moz-any-link, x:default { /*FireFox 3*/ }
 
html>/**/body .foo, x:-moz-any-link, x:default { /* Only FireFox 3 */ }

另外还有通过IE的条件注释方式进行hack,全文见:
http://www.javascriptkit.com/dhtmltutors/csshacks.shtml

日志所属分类: 2.Web程序开发 | 本文地址: http://xinple.org/?p=273
打印此文: Print This Post | TrackBack: http://xinple.org/wp-trackback.php?p=273

3 Responses to “CSS Hack”

  1. jj says:

    高手,想请教一个问题!为什么现在不能在国内打开www.facebook.com?? 这么好的博客网也不能用!!

  2. hi says:

    因为现在很多国外大型站点有不少违法信息,被屏蔽了,所以无法观看,可以网上搜索“翻墙”,通过翻墙出国之后就能观看了。

  3. [...] hack。其实完全理解错了,浏览器支不支持现在流行的css hack是根据Quirks Mode和Standards Mode来进行渲染的。所以如果是Quirks Mode就不支持css [...]

Leave a Reply

*