考虑下面的笔:http://codepen.io/anon/pen/xVgevE
我们的flex标记,<right-component>在第三方布局的块中,也就是在一个高度不受限制的div中。
div本身在一个外部的flexbox布局中。
如何让内部flex组件填充可用高度,而不对其进行硬编码,或者完全覆盖第三方组件的所有样式以使其由flexbox驱动?
发布于 2016-03-19 02:58:00
您是否正在尝试让正确的内容填充空间。如果是,则此jsFiddle可能包含答案:https://jsfiddle.net/Dneilsen22/crfz66jx/
您有一个高度设置为100vh的根,因此通过创建一个像rightComponent这样的容器并将其设置为相同的高度,我们可以让内容填充100%的空间。
CSS:
#rightComponent {
height: 100vh;
display: flex;
flex-direction: column;
}
#right-content {
display:flex;
flex-direction: column;
background: #779;
height:100%
}HTML:
<uncontrollable-third-party-component>
<div>Third party stuff</div>
<div id="rightComponent">
<div id="right-topbar">
Right topbar
</div>
<div id="right-content">
Right content
</div>
</div>
</uncontrollable-third-party-component>https://stackoverflow.com/questions/36091289
复制相似问题