Im here because other similar questions couldn\'t help my particular problem.
I need right div
to be 100% height all the time, where the parent
You can accomplish this using flexbox and some creativity.
.container {
display: flex;
background: black;
padding: 5px;
width: 300px
}
.left {
height: 200px;
flex: 1 0 0px;
background: blue;
}
.right {
flex: 1 0 0px;
overflow: auto;
background: green;
}
.column {
display: flex;
flex-direction: column;
width: 20%;
}
<div class="container">
<div class="left"></div>
<div class="column">
<div class="right"></div>
</div>
</div>
.parent{
position: relative;
width: 100px;
height: auto;
}
.child{
width: 50px;
height: 100px;
background-color: red;
}
.child_absolute{
position: absolute;
left: 50px;
top: 0;
bottom: 0;
width: 50px;
background-color: blue;
}
<div class="parent">
<div class="child"></div>
<div class="child_absolute"></div>
</div>
By reading your comments on other solutions it is clear to me that only solution for you is to implement some JS into your code. This is not a problem, however.
http://jsfiddle.net/b7TuP/
You can use the table-cell
value of the display
property in this layout and remove the float
like this:
.left, .right{
display:table-cell;
}
live demo http://jsfiddle.net/C9Kmx/34/
Make the right div position:absolute;
and make the parent div position:relative;
and then height:100%;
will work for the right div. Make sure you also adjust its x-position and width accordingly. In this example I gave it a left:50px
to make sure it appears to the right of the left column.
JSFiddle http://jsfiddle.net/e9mvD/
Give position:fixed
and height:100%
for the right div. This will solve your issue.