简体   繁体   中英

Inner element does not extends parent height element

Why green element does not extends blue elements heights?

I cant set this to work properly,is there any solution to make deeper element to extend container?Yellow must have fixed height its is a masonry grid in real life example and i dont know why it doesnt stretch to inner elements properly.

 .blue { width:100vw; min-height:100vh; background-color:blue; padding:5px; } .yellow { background-color:yellow; height:100px; width:100px; padding:5px; } .green { background-color:green; height:1500px; width:50px; } 
 <div class="blue"> <div class="yellow"> <div class="green"> </div> </div> </div> 

I'm not sure what you want. Is this?

 .blue { float:left; width:100vw; min-height:100%; background-color:blue; padding:5px; } .yellow { background-color:yellow; height:100px; width:100px; padding:5px; } .green { float:left; background-color:green; height:1500px; width:50px; } 
 <div class="blue"> <div class="yellow"> <div class="green"> </div> </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