html自动收缩,html div的自动伸缩

  • Post author:
  • Post category:其他


html div的自动伸缩

.winstonDivClass{ overflow:hidden; zoom:1; }

如果父div需要根据子div的大小的变化而变化,那么这个父div

需要加上class=”winstonDivClass”

,且该父div不能指定height属性,其中的子div的position属性最好为relative;

用zoom:1;触发ie的haslayout,用来清浮动

而overflow可以触发ie7的haslayout,并在FF下也能清理浮动。

如果想指定子div的最小高度,在ie7和其他浏览器下可以指定div的Min-height属性,但是在ie6里min-height属性貌似不被支持,所以兼容的方法应该是在该子div上也加上

class=”winstonDivClass”,然后在里面加上一个width:0px,positon:relative,height:xxx

px

;的div,这样就可以实现Min-height:xxx

px

;相同的效果。

相关文档: