css - div 的高度与其旁边的内容不一致

标签 css html height

我会解释我的问题:

我有一个包含 3 个其他 div 的内容 div:

                #content
#menu            #text          #sidebar
..          text...........      ------
..          text...........      ------
..          text...........      ------
            text...........      ------
            text...........
            text...........

这就是它的样子,#sidebar 中的条纹显示其中的内容。 侧边栏有一个绿色背景,这种颜色贯穿整个网站。

但我想要的是#sidebar 的长度将与#text 的长度相同。它应该看起来像这样:

                #content
#menu            #text          #sidebar
..          text...........      ------
..          text...........      ------
..          text...........      ------
            text...........      ------
            text...........      ------     
            text...........      ------

我不是专业的程序员,所以我希望有人能帮助我。我已经尝试过一些“合乎逻辑”的事情,例如: - 将#sidebar 的高度设置为自动 - 将#sidebar 的高度设置为 100%(这只会让它变长一点)

希望有人能帮助我!提前致谢。

最佳答案

如果您在内容 div 上定义一个高度,并为每棵树赋予 style="height:inherit"应该这样做:)

关于css - div 的高度与其旁边的内容不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15158629/

相关文章:

php - preg_replace all img tags with else 东西

php - 将 php $headers 放在特定联系表单中的何处以更改电子邮件 'From' 地址

javascript - 为什么在使用 jQuery replaceWith() 时标记 <constructor> 会导致 'undefined'?

html - 居中的文本框,周围环绕着边框

jquery - 你如何使用 jQuery 获得全高

css - Sass 问题 : concatenating the elements

jquery - 如何使用 Metro UI CSS 保存可拖动的位置?

html 属性是否正确(就标准而言)?

jquery - 如何以 AngularJS 1.x 方式将 Kendo-UI 网格的高度扩展到 100%?

html - 尝试使用 CSS 在页面底部排列单独的 div