SO height example

StackOverflow example

by Oliver Caldwell

HTML

<div class="parent">
    <div class="child-left floatLeft" id='chil'>
        Hello world<br />
        This is some content<br />
        Blah blah blah...
    </div>

    <div class="child-right floatLeft" id='chir'>
    </div>
</div>

CSS

div.child-right {
    width: 30px;
    background-color: #666666;
}

div.floatLeft {
    float: left;
}

JavaScript

var chil = document.getElementById('chil');
var chir = document.getElementById('chir');

chir.style.height = (window.getComputedStyle) ?
                    window.getComputedStyle(chil, null).height :
                    chil.currentStyle.height;