【发布时间】:2021-02-14 18:11:11
【问题描述】:
Panel1 的高度根据内容改变高度。
Panel2 有一个固定的高度。
还有我的问题:我想要Panel3 像height = panel1.height - panel2.height 这样的“完美”高度
但我不知道该怎么做。
【问题讨论】:
标签: html css twitter-bootstrap-3
Panel1 的高度根据内容改变高度。
Panel2 有一个固定的高度。
还有我的问题:我想要Panel3 像height = panel1.height - panel2.height 这样的“完美”高度
但我不知道该怎么做。
【问题讨论】:
标签: html css twitter-bootstrap-3
试试这样的——
使用 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";,现在完美了。
这个框架在一行height.. 中完成工作,如果你放动态内容,它总是自我调整
框架:https://github.com/mattbanks/jQuery.equalHeights 代码:https://codepen.io/micahgodbolt/pen/FgqLc
【讨论】: