边栏高度伸展与内容高度CSS

问题描述:

我有2个DIV:

<div id="sidebar"></div>
<div id="content"></div>

我如何使侧边栏的div与内容的高度相同。

How would i make the sidebar div stretch the same height as the content.

感谢任何帮助。

更新:

与其他元素的代码:

http://tinkerbin.com/tkp2FZLZ

它在中间有一个内容DIV,有4个div,这使得边框是不同的颜色。

it has a content DIV in the Middle and 4 divs that makes border which is a different color.

您可以通过 display:table-cell;

HTML

<div id="sidebar">sidebar</div>

<div id="content">content</div>

CSS

#sidebar {
display:table-cell;
width:100px;
background:red;

}
#content {
display:table-cell;
width:100px;
background:yellow;
height:200px;
}

我认为你看起来像这样 -
http://tinkerbin.com/yqyX3mXg

i think you are looking like this ;- http://tinkerbin.com/yqyX3mXg