简体   繁体   English

垂直对齐3个“面板默认面板”,使其高度相同

[英]Vertical align 3 “panel panel-default” so they are all the same height

I have a row and in that row I have 3 parts which all are using the same code to generate but I can not keep them the same height. 我有一行,在那一行中,我有3个部分,它们都使用相同的代码来生成,但是我不能保持它们的高度相同。 I am using HTML 5 and also using Bootstrap 3. on the "panel panel-default" I have tried using a "min-height" but when I add link to one of the sections, it only expands that section. 我正在使用HTML 5,也在“面板默认面板”上使用了Bootstrap3。我尝试使用“最小高度”,但是当我将链接添加到其中一个部分时,它只会扩展该部分。

It's a little hard for me to explain. 我很难解释。

my view is: 我的看法是:

<div class="col-sm-4">
    <div class="form-group">
        <div class="panel panel-default" style="min-height: 540px">
            <div class="panel-heading">
                <h3 class="panel-title"><%=title %></h3>
            </div>
            <div class="panel-body">
                <div class="form-horizontal"><%=template.ToString() %></div>
            </div>
        </div>
    </div>
</div>

Which makes the page look like: 这使得页面看起来像:

这使得页面看起来像:

Now as each column is using the same code how can I keep each one in-line so if a new link was added/removed to one the first. 现在,由于每一列都使用相同的代码,因此如何保持每一行的位置,因此如果将新链接添加/删除到第一行,则该链接保持不变。 each panel border runs inline. 每个面板边框都是内联的。

At the present I have a min-height set but the screenshot below shows this doesn't work when a new link is added. 目前,我已经设置了min-height但是下面的屏幕截图显示,添加新链接后,此设置无效。

I would like to do it without the use of CSS or Java/JQuery. 我想在不使用CSS或Java / JQuery的情况下做到这一点。

I think what you're looking for is something like this.. 我认为您正在寻找的是这样的东西。

http://www.bootply.com/iH9uUHI4Zs http://www.bootply.com/iH9uUHI4Zs

.flex, .flex > div[class*='col-'] {  
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    flex:1 0 auto;
}

It uses CSS flexbox to make the height of the columns in a row the height of the tallest. 它使用CSS flexbox将连续的列的高度设置为最高的高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM