日期:2014-05-17  浏览次数:20642 次

IE6下的 CSS 和 HTML 注意事项


1, 关于图片

IE6只支持8位的PNG透明图片,所以,所有透明图片,需要转换成GIF格式的才能正常显示。

2,关于float以后的margin-left双倍问题

所有float:left后面,都要加上

overflow: hidden;

display:inline;

3,float以后,撑开边框的方法

在float层的父层,加上:

#main-body:after {

?? ?content: "";

?? ?height: 0;

?? ?display: block;

?? ?clear: both;

}

如果上述方法无效的话,在float的层最后,加一个DIV层

<div style="clear:both"></div>

例如:

?

<div class="float-father">
     <div class="float-left">......</div>
     <div class="float-left">......</div>
     <div style="clear:both"></div>
</div>
?

4, padding-left and margin-left感觉都失效的问题

使用之前,需要在父层定义:

text-align:left;

同样的,如果想要使用padding-right,父层也不许加上定义

text-align:right;

5,关于javascript:void(0)

估计写ajax,现在很多人都会用到这个,但是在IE6,在a标签的href属性中使用javascript:void(0),会导致一定的bug。

例如:gif格式的动态图片突然没反应了

解决方法:避免a标签与javascript:的混合使用。比如,可以用span标签和css代码伪装一个超链接