html - 如何显示 : table-cell be the same height with my CSS?

标签 html css

我有以下 HTML:

<article id="articlesss" class="container_12 clearfix" style="margin-top: 2em; display: table;">
    <div style="display: table-row">
        <div class="grid_6" style="display: table-cell;">
            <div class="block-border">
                <div style="background-color: red; height: 100px;"></div>
            </div>
        </div>
        <div class="grid_6" style="display: table-cell;">
            <div class="block-border">
                <div style="background-color: red; height: 200px;"></div>
            </div>
        </div>
    </div>
</article>

我正在使用 display: table-row,因为我听说这会使我的 DIV 像表格单元格一样工作,而且我希望 DIV 具有相同的高度。然而,似乎第一个 grid_6 网格的高度很小,而第二个网格至少有 100px。我怎样才能让它填充到相同的高度?

这是一个例子:fiddle

最佳答案

<div class="block-border">
        <div style="background-color: red; height: 100px;"></div>

您已经设置了第二个元素的高度,即 Height = 100px 。

为两个 div 元素设置高度。

关于html - 如何显示 : table-cell be the same height with my CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14855313/

相关文章:

html - 带有子菜单 CSS HTML 的下拉菜单

javascript - 创建一个具有 onclick 滑动功能的 jQuery Slider

javascript - 如何使效果从上到下1页像android标题栏一样使用css3

javascript - 可以消除 'a' 标签吗?

javascript - Flexslider 在 html 站点中不工作(jQuery 未加载?)

html - CSS 当悬停在 anchor 上时,更改其所在的 div 的背景颜色

javascript - 使用 ajax 从 get in php 中检索许多值

html - Bootstrap 列在左侧和右侧填充 - 我可以改用边距吗?

html - 仅使用 CSS 的条件 div 向右浮动(如果文本后有足够的空间)

javascript - 圆形进度条不是从中间开始