详细内容
Div自适应高度的解决方案
发布日期:2015-04-03     点击:4672     字体:[ ]

在写html里,如果不指定高度,下面的内容就会串上来,div自适应高度就很好的解决了这个问题:

例如:这里的productClass没指定高度,所以不能根据bigClass的高度自动适应,解决办法就是给productClass的定义加上  height:auto !important;

.productClass
{
 width:284px;
 height:auto !important;
}

只这样处理还没结束,还要在productClass所在div里再加一个空DIV,看到下面那个空div了吗(  <div style="clear:both"></div>),这样productClass这个div就很好的自适应高度了

 <div class="productClass">
    <div class="bigClass">
    </div>


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

用户评论
昵称 
内容  *
验证码   
   
Copyright © 2010 zdbase.com All Rights Reserved. 苏ICP备15039389号 可人软件设计