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

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

WBOY
WBOYOriginal
2016-06-24 11:53:18967Durchsuche

怎么着能让父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成一行?
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn