Here is my code.
HTML:
<div class="div1">
<div class="div2">
Div2 starts <br /><br /><br /><br /><br /><br /><br /> Div2 ends
</div>
<div class="div3">
Div3
</div>
</div>
CSS:
.div1 {
width: 300px;
height: auto;
background-color: grey;
border: 1px solid;
overflow: auto;
}
.div2 {
width: 150px;
height: auto;
background-color: #F4A460;
float: left;
}
.div3 {
width: 150px;
height: auto;
background-color: #FFFFE0;
float: right;
}
I want to increase the height of div3
dynamically.
For example, if the height of div1
is 500px
then the height of div3
should be 500px
. I know, I can use inherit, but the height of div1
is auto
so it won't help.
Here is my fiddle http://jsfiddle.net/prashusuri/E4Zgj/1/
How to do this?
#container-of-boxes {
display: table;
width: 1158px;
}
#box-1 {
width: 578px;
}
#box-2 {
width: 386px;
}
#box-3 {
width: 194px;
}
#box-1, #box-2, #box-3 {
min-height: 210px;
padding-bottom: 20px;
display: table-cell;
height: auto;
overflow: hidden;
}
By specifying the positions we can achieve this,
.div1 {
width:300px;
height: auto;
background-color: grey;
border:1px solid;
position:relative;
overflow:auto;
}
.div2 {
width:150px;
height:auto;
background-color: #F4A460;
float:left;
}
.div3 {
width:150px;
height:100%;
position:absolute;
right:0px;
background-color: #FFFFE0;
float:right;
}
but it is not possible to achieve this using float.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With