Home:ALL Converter>Stretching height DIV under another DIV with fixed height

Stretching height DIV under another DIV with fixed height

Ask Time:2014-09-13T14:21:36         Author:bea

Json Formatter

I've made the picture to talk less. Hope you will understand. The problem is that stretching 100% height DIV under other DIV with fixed height doesn't stretch properly.

Problem is

Here's example to work with: jsfiddle

css:

.controlling-div {
    width: 200px; 
    height: 200px;
}

.stretching-container-div {
    width: 100%; 
    height: 100%;
}

.fixed-height-div {
    height: 40px;
    background-color: #ff8811;
    border-radius: 20px;
}

.stretching-height-div {
    height: 100%;
    background-color: #ff2266;
    border-radius: 20px;
}

html:

<div class="controlling-div"><!-- width & height can be changed -->
    <div class="stretching-container-div"><!-- 100%-container -->
        <div class="fixed-height-div"></div><!-- fixed height -->
        <div class="stretching-height-div"></div><!-- height 100% - fixed height -->
    </div>
</div>

Thanks!

Author:bea,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25820419/stretching-height-div-under-another-div-with-fixed-height
himanshu :

jsfiddle\n\n.stretching-height-div {\n height: calc(100% - 40px);\n background-color: #ff2266;\n border-radius: 20px;\n}\n",
2014-09-13T06:44:42
yy