|
|
|
下面的CssHack对这些浏览器有效: ![]() 下面的CssHack对这些浏览器无效: ![]() #div1:first-child{ color:red; } #div1>#div2{ font-size:200%; } html[xmlns] #div2{ text-decoration:underline; } 下面的CssHack对这些浏览器有效: 下面的CssHack对这些浏览器无效: ![]() #div2{ *border:2px solid red; } 下面的CssHack对这些浏览器有效: ![]() 下面的CssHack对这些浏览器无效: ![]() #div2{ _width:100px; } * html #div2{ height:100px; } 下面的CssHack对这些浏览器有效: 下面的CssHack对这些浏览器无效: ![]() *+html #div2{ background-color:yellow } 下面是完整的代码,你可以在不同的浏览器下浏览以便查看效果。 <!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 三种浏览器的最终效果图:<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="YES!B/S!" /> <meta name="Description" content="This page is from http://Justinyoung.cnblogs.com" /> <title>CSS/Javascript demo</title> <style type="text/css"> *{ font-size:medium; margin:2px; padding:2px; } /* valid : FF IE7 OP8 invalid : IE6 */ #div1:first-child{ color:red; } #div1>#div2{ font-size:200%; } html[xmlns] #div2{ text-decoration:underline; } /* valid : IE6 IE7 invalid : FF OP8 */ #div2{ *border:2px solid red; } /* valid : IE6 invalid : FF IE7 */ #div2{ _width:100px; } * html #div2{ height:100px; } /* valid : IE7 invalid : FF IE6 */ *+html #div2{ background-color:yellow } /*Test Min-height*/ #div3{ border:1px dotted green; width:100px; /*min-height is valid in FF and IE7. it's very important for kill "auto height" problem*/ min-height:100px; height:50px; } </style> </head> <body> <div id="div1"> <div id="div2"> i'm test text. </div> <div id="div3"> test min-height! </div> <p> 首先应该明确的是:尽量不要使用css hack,因为它的向前兼容是未知的。<br/> 基于现在中国互联网的现状,这里主要对IE6,IE7和FF的最常用且实用的css Hack进行了介绍,但是并不表示css只有这些。<br/> 有些其实已经不是css hack了,而是css的一些新的选择器,例如"#div1>#div2"和"#div1:first-child",对于这样的选择器一般可以放心的使用,因为有较好的向后兼容性。 </p> </div> </body> </html> ![]() keyword:css样式表,css hack,css hack表,css hack firefox,ie css hack,csshack,CSS hack浏览器兼容一览表,CSS Hack汇总快查,css hack下载,ie7csshack,firefoxcsshack,ie6csshack |




