简体   繁体   中英

Stretch the <div> to the full height of the parent <div>

There are many div blocks. One parent, the second inside the left (for the menu), the second inside the right (for the text). How it is possible to stretch the right inner block (it is possible with the left one) to the entire height of the parent block. The parent block it has min-height:1100px

Here's the code:

<div id="wrapctr">
    <div id="leftmenu"></div>
    <div class="rightcontent">
        //common div
        <div style="padding: 10px; width: 100%; overflow: hidden; display: flex; flex-wrap: wrap; justify-content: space-between; background:white">
            // img div
            <div style="float: left; padding: 10px; text-align: center; width: 257px;"><img src="../img/1625.jpg" width="200"></div>
        </div>
    </div>
</div>

CSS

#wrapctr {
    width:80%;
    min-width: 700px;
    max-width: 1200px;
    background:#FFF;
    margin:0 auto;
    min-height:1100px;
    z-index:2;        
}

#leftmenu { 
    background: #FFF;
    float: left;
    width: 250px;
    list-style: none;
}
.rightcontent {
    background: #FFF; 
    margin-left: 255px; 
}

One page show 12 images are issued in three in a row. If i added position:relative and absolute with height:100% my div with style comes out of rightcontent div

您应该为您的常用div赋予wrapctr相对位置和绝对位置,然后就可以为常用div赋予高度100%

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