注册会员 登录
大众世界 world of demotic + 社区新动力 返回首页

add的个人空间 https://www.wod.cn/?1 [收藏] [复制] [分享] [RSS]

日志

ie9 css hack

已有 1819 次阅读2013-2-18 14:49 |个人分类:javascript&html&css| css

废话少说,直接上码: 

test {
color:red\9\0; 
}

---------------------------------------

test {
color:red; /* all */
color:red\9; /* ieAll */
color:red\0; /* ie8/9 */
*color:red; /* ie6/7 */
_color:red; /* ie6 */
}



/***** Selector Hacks ******/
   
/* IE6及更低版本浏览器 */
* html #uno  { color: red }
   
/* IE7 */
*:first-child+html #dos { color: red } 
   
/* IE7, FF, Saf, Opera  */
html>body #tres { color: red }
   
/* IE8, FF, Saf, Opera (除了IE 6、7的所有浏览器) */
html>/**/body #cuatro { color: red }
   
/* Opera 9.27 and below, safari 2 */
html:first-child #cinco { color: red }
   
/* Safari 2-3 */
html[xmlns*=""] body:last-child #seis { color: red }
   
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:nth-of-type(1) #siete { color: red }
   
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:first-of-type #ocho {  color: red }
   
/* saf3+, chrome1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) {
 #diez  { color: red  }
}
   
/* iPhone / mobile webkit */
@media screen and (max-device-width: 480px) {
 #veintiseis { color: red  }
}
   
   
/* Safari 2 - 3.1 */
html[xmlns*=""]:root #trece  { color: red  }
   
/* Safari 2 - 3.1, Opera 9.25 */
*|html[xmlns*=""] #catorce { color: red  }
   
/* 除了ie 6-8的所有浏览器 */
:root *> #quince { color: red  }
   
/* IE7 */
*+html #dieciocho {  color: red }
   
/* Firefox. 1+ */
#veinticuatro,  x:-moz-any-link  { color: red }
   
/* Firefox 3.0+ */
#veinticinco,  x:-moz-any-link, x:default  { color: red  }
   
/* FF 3.5+ */
body:not(:-moz-handler-blocked) #cuarenta { color: red; }
   
   
/***** Attribute Hacks ******/
   
/* IE6 */
#once { _color: blue }
   
/* IE6, IE7 */
#doce { *color: blue; /* o或者 #color: blue */ }
   
/* 所有浏览器,除了 IE6 */
#diecisiete { color/**/: blue }
   
/* IE6, IE7, IE8 */
#diecinueve { color: blue\9; }
   
/* IE7, IE8 */
#veinte { color/*\**/: blue\9; }
   
/* IE6, IE7 -- 和!important作用相同 */
#veintesiete { color: blue !ie; } /* 感叹号后边可以是任意字符串 */
   
/* IE8, IE9 */
#anotherone  {color: blue\0/;} /* 必须放在所有规则的最后面 */

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册会员

Archiver|手机版|小黑屋|Wod Inc. ( 蜀ICP备20000008号-8

GMT+8, 2024-5-19 15:46 , Processed in 0.074479 second(s), 29 queries .

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

返回顶部