在研究了一整天的灵活盒子模型后,我必须说我真的很喜欢它。它以一种快速干净的方式实现了我在JavaScript中实现的功能。然而,有一件事让我感到困扰:
我无法展开div以获取由弹性框模型计算的完整大小!
为了说明这一点,我将举出一个例子。在它中,两个灵活的位置采用精确的with和height,但其中的div只采用"<p>...</p>"
元素的高度。对于这个例子,这并不重要,但我最初尝试的是将一个“灵活的盒子模型”放在另一个“灵活的盒子模型”中,在我看来,这必须是可能的
html, body {
font-family: Helvetica, Arial, sans-serif;
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
#box-1 {
background-color: #E8B15B;
}
#box-2 {
background-color: #C1D652;
}
#main {
width: 100%;
height: 100%;
overflow-x: auto;
overflow-y: hidden;
}
.flexbox {
display:-moz-box;
display:-webkit-box;
display: box;
text-align: left;
overflow: auto;
}
H1 {
width: auto;
}
#box-1 {
height: auto;
-moz-box-orient: vertical;
-webkit-box-orient: vertical;
box-orient: vertical;
-moz-box-flex: 3;
-webkit-box-flex: 3;
box-flex: 3;
}
#box-2 {
height: auto;
min-width: 50px;
-moz-box-orient: vertical;
-webkit-box-orient: vertical;
box-orient: vertical;
-moz-box-flex: 1;
-webkit-box-flex: 1;
box-flex: 1;
}
#fullsize{
background-color: red;
height: 100%;
}
<div id="main" class="flexbox">
<div id="box-1" class="flexbox">
<div id="fullsize">
<p>Hallo welt</p>
</div>
</div>
<div id="box-2" class="flexbox">
</div>
</div>
https://stackoverflow.com/questions/7676022
复制相似问题