首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >HTML5柔性箱体模型高度计算

HTML5柔性箱体模型高度计算
EN

Stack Overflow用户
提问于 2011-10-06 22:43:46
回答 3查看 38.8K关注 0票数 21

在研究了一整天的灵活盒子模型后,我必须说我真的很喜欢它。它以一种快速干净的方式实现了我在JavaScript中实现的功能。然而,有一件事让我感到困扰:

我无法展开div以获取由弹性框模型计算的完整大小!

为了说明这一点,我将举出一个例子。在它中,两个灵活的位置采用精确的with和height,但其中的div只采用"<p>...</p>"元素的高度。对于这个例子,这并不重要,但我最初尝试的是将一个“灵活的盒子模型”放在另一个“灵活的盒子模型”中,在我看来,这必须是可能的

代码语言:javascript
复制
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%;
}
代码语言:javascript
复制
<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>

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7676022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档