简体   繁体   中英

CSS two horizontal divs equal height

<div>
   <div>
     hello1
   </div>
   <div>
     hello2
   </div>
</div>

I want the two inner div 's to take/fill up the whole space of the outer div (height/vertically). But both inner div 's should have the equal height

You can use CSS' flexbox , see my example below:

 .row { display: flex; } .col { border: 1px solid; flex: 1; }
 <div class="row"> <div class="col"> hello1 </div> <div class="col"> hello2<br> same height! </div> </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM