【问题标题】:Bootstrap Auto Height PanelsBootstrap 自动高度面板
【发布时间】:2021-02-14 18:11:11
【问题描述】:

我有 3 个面板(见图)

Panel1 的高度根据内容改变高度。 Panel2 有一个固定的高度。 还有我的问题:我想要Panel3height = panel1.height - panel2.height 这样的“完美”高度

但我不知道该怎么做。

【问题讨论】:

    标签: html css twitter-bootstrap-3


    【解决方案1】:

    试试这样的——

    使用 javascript

    var panel1Height = document.getElementById('panel1').clientHeight;
    var panel2Height = '20';
    var panel3Height = panel1Height - panel2Height;
    document.getElementById("panel3").style.height= panel3Height + 'px';
    

    注意 这只是一个模型,可以根据您的需要进行定制。

    【讨论】:

    • 最后一行必须看这个document.getElementById("panel3").style.height= panel3Height + "px";,现在完美了。
    【解决方案2】:

    这个框架在一行height.. 中完成工作,如果你放动态内容,它总是自我调整

    框架:https://github.com/mattbanks/jQuery.equalHeights 代码:https://codepen.io/micahgodbolt/pen/FgqLc

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-16
      • 2013-09-10
      • 1970-01-01
      • 2015-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多