一、css hack
以下两种方法几乎能解决现今所有hack.
1, !important
随着ie7对!important的支持, !important 方法现在只针对ie6的hack.(注意写法.记得该声明位置需要提前.)
代码如下
#wrapper
{
width: 100px!important;
width: 80px;
}
2, ie6/ie77对firefox
* html 与 *html 是ie特有的标签, firefox 暂不支持.而* html 又为 ie7特有标签.
代码如下
#wrapper
{
#wrapper { width: 120px; }
*html #wrapper { width: 80px;}
* html #wrapper { width: 60px;}
}
注意:
* html 对ie7的hack 必须保证html顶部有如下声明:
"">
二、float 闭合(清除浮动)
将以下代码加入global css 中,给需要闭合的div加上 class="clearfix" 即可,屡试不爽. 代码如下
.clearfix:after
{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
.clearfix
{
display:inline-block;
}
.clearfix {display:block;}