1

Here is working solution for Chrome and probably Firefox:

http://jsfiddle.net/gHcRX/

Adding height:100% to all tables gives the div required data to calculate the actual height of parent.

But why this doesn't work in Internet Explorer and Opera...

Don't want to use javascript for this.

Is there any simple cross-browser solution?

JJJ
  • 32,902
  • 20
  • 89
  • 102
Somebody
  • 9,316
  • 26
  • 94
  • 142

2 Answers2

0

This may do what you need, using Divs instead of tables:

<div>
    <div style="height:300px; float: left;">
        <div style="height:100%;background:black; float: left;">block1</div>
        <div style="height:100%;background:red; float: left;">block2</div>
    </div>
</div>

Much neater

Yule
  • 9,668
  • 3
  • 51
  • 72
0

First off, you should NOT be using tables for layout. It's bad practice, and will not work well across different browsers.

If all you want to achieve is getting the divs to expand 100%, you could do something like this:

<div style="height:300px">
    <div style="float:left;height:100%;background:green;">block1</div>
    <div style="float:left;height:100%;background:red;">block2</div>
</div>

http://jsfiddle.net/gHcRX/20/