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
height depends on left div
height which depends on content inside.
Here is the html:
<div class="container clearfix">
<div class="left"></div>
<div class="right"></div>
</div>
Here is CSS:
.container{
min-height: 10px;
width: auto;
height: auto;
background-color: #eeeeee;
}
.left{
position: relative;
float: left;
min-height: 100px;
width: 50px;
background-color: #dddddd;
}
.right{
min-height: 20px;
position: relative;
float: left;
height: 100%;
width: 50px;
background-color: #dddddd;
}
.
.clearfix:after
{
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
Note:
I'm using clearfix
.
And if you can show your answer in jsfiddle
Here is jsFiddle http://jsfiddle.net/C9Kmx/32/
Try by giving the height of container a fixed value
this will also fix the issue. Just tried it in jsFiddle
http://jsfiddle.net/C9Kmx/35/
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 thedisplay
property in this layout and remove thefloat
like this:live demo http://jsfiddle.net/C9Kmx/34/
Make the right div
position:absolute;
and make the parent divposition:relative;
and thenheight:100%;
will work for the right div. Make sure you also adjust its x-position and width accordingly. In this example I gave it aleft:50px
to make sure it appears to the right of the left column.JSFiddle http://jsfiddle.net/e9mvD/
You can accomplish this using flexbox and some creativity.
Give
position:fixed
andheight:100%
for the right div. This will solve your issue.