Home  >  Article  >  Web Front-end  >  为什么父div的clientheight比它孩子的clientHeight还小?_html/css_WEB-ITnose

为什么父div的clientheight比它孩子的clientHeight还小?_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:53:18966browse

怎么着能让父div的高度随着孩子div高度的增加而增加?


   

   


分区1的高度为100px。而分区2的高度为200px.这种结果是怎么造成的?


回复讨论(解决方案)

用float了吧,清下float

用float了吧,清下float


恩,用了,果然是它造成的,不用它的话,怎么让两个div成一行?

参考

<div style="background:red;">  <div style="display:inline-block;">aaaaaa</div><div  style="display:inline-block;">cccc<br>bbbbb</div>  </div>  <br><div style="background:red;">  <div>aaaaaa</div><div  style="float:right;">cccc<br>bbbbb</div> <div style="clear:both;"></div> </div>



用float了吧,清下float


恩,用了,果然是它造成的,不用它的话,怎么让两个div成一行?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn