本文主要包含css ie6,ie6 bug的解决方法,ie6bug,ie6常见的bug,ie6双边距bug等相关知识,佚名 希望在学习及工作中可以帮助到您
IE6,这个前端开发的梦魇总是在你不经意的时候给你捅一刀。这次碰到的问题是CSS多类选择符的问题。IE6不支持,我们来看一段这样简单的代码:
<!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" /> <title>选择符测试</title> <style type="text/css"> div{display:block;width:400px;height:200px;} #first.son{background:#ccc;} .second.son{border:1px solid red;} </style> </head> <body> <div id="first" class="son first"> a </div> <div id="second" class="son second"> b </div> </body> </html>
提示:您可以先修改部分代码再运行</div>
形如#first.son的选择符,支持性很好,ie6及以上,ff,opera,safari等浏览器都支持。
形如.second.son的选择符,在ie6下不支持,后一个类名会覆盖前一个类名,即直接识别为.son
其实可以利用第二条情况,作为一个针对ie6的hack来使用:
.xxx.son{} 只要.xxx部分是一个不存在的类名。就可以屏蔽ie6之外的浏览器。只对ie6下的.son有效。
这个hack的效果同 selector{ _property:value; } 大体一致。 </div>
<!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" /> <title>选择符测试</title> <style type="text/css"> div{display:block;width:400px;height:200px;} #first.son{background:#ccc;} .second.son{border:1px solid red;} </style> </head> <body> <div id="first" class="son first"> a </div> <div id="second" class="son second"> b </div> </body> </html>
提示:您可以先修改部分代码再运行</div>
形如#first.son的选择符,支持性很好,ie6及以上,ff,opera,safari等浏览器都支持。
形如.second.son的选择符,在ie6下不支持,后一个类名会覆盖前一个类名,即直接识别为.son
其实可以利用第二条情况,作为一个针对ie6的hack来使用:
.xxx.son{} 只要.xxx部分是一个不存在的类名。就可以屏蔽ie6之外的浏览器。只对ie6下的.son有效。
这个hack的效果同 selector{ _property:value; } 大体一致。 </div>