div高度取决于另一个div高度

问题描述:

我有两个div,其中一个依赖于另一个。

I have two divs that one of them is dependant on the other one.

|Second Div| |First Div|
|          | |         |
|          | |         |
|          | |         |

第一个div的高度已定义:

The height of the first div defined:

height:auto;

我的问题是如何定义第二个div高度, >

My problem is how to define the second div height so it will be like the first.

使用 display:table / table-cell

.parent{
  display:table;
  width:600px; /* some value*/
  border: 1px solid black;
}

.left{
  display:table-cell;
  height: 500px; /* some value*/
  background: red;
}

.right{
  display:table-cell;
  background: blue;
}

<div class="parent">
    <div class="left"></div>
    <div class="right"></div>
</div>

JSFiddle