简体   繁体   English

根据 div 高度 bootstrap 自动调整面板的高度

[英]Auto adjust height of the panel based on div height bootstrap

I am newbie to front end development.. We are building a one page app and we have two panels.我是前端开发的新手。我们正在构建一个单页应用程序,我们有两个面板。

Panel at the top contains a input text for search and below the input text is a ag-grid with pagination.顶部的面板包含用于搜索的输入文本,输入文本下方是带分页的 ag-grid。

When user clicks on some of the cell values in the grid column, a div with explanatory text appears below the grid and within the panel.当用户单击网格列中的某些单元格值时,带有解释性文本的 div 会出现在网格下方和面板内。 Now this text length can vary from 2 lines to 20 lines.现在这个文本长度可以从 2 行到 20 行不等。 What I would like to achieve is auto adjust the panel height to cover both ag-agrid and div without any empty space when text is smaller and not have the text in div overflow the panel when the text is larger and this should work fine in all resolutions.I am using bootstrop css classes for panel - panel primary for panel..appreciate any insights..我想要实现的是自动调整面板高度以覆盖 ag-agrid 和 div,当文本较小时没有任何空白,并且当文本较大时 div 中的文本不会溢出面板,这应该可以正常工作决议。我正在为面板使用 bootstrop css 类 - 面板的主要面板..感谢任何见解..

  <div class="container-fluid">
     <div class="panel panel-primary" style="height:auto">
         <div class= "panel-heading"> {{panelTitle}} </div>
            <div class="panel body">

                <ag-grid-angular class="ag-blue" [gridoptions]="gridOptions" rowModelType="pagination" style="min-height:70%"></ag-grid-angular>

                  <div class="alert"> {{description}}
                   </div>
            </div>
     </div>
 </div>

U can use a css to set the height of the panel automatically U可以使用CSS来自动设置面板的高度

.panel_name{
   height:auto;
}

In bootstrap you can use the class "h-auto"在引导程序中,您可以使用 class “h-auto”

<div class="container-fluid">
   <div class="panel panel-primary h-auto">
     <div class= "panel-heading"> {{panelTitle}} </div>
        <div class="panel body">
            <ag-grid-angular class="ag-blue" [gridoptions]="gridOptions" rowModelType="pagination" style="min-height:70%"></ag-grid-angular>
              <div class="alert"> 
                 {{description}}
              </div>
        </div>
   </div>
</div>

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

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