为什么嵌套的Flexbox无法在Chrome中使用?

汤姆

我有带嵌套flexbox的代码:https ://jsfiddle.net/tomrhodes/8pf1q706/ ,我希望“内容2”总是填充剩余的空间。它可以在Firefox上运行,但不能在Google Chrome上运行,为什么不起作用?

重要的是不要同时使用一个div元素作为flexbox的项目和父项,所以-我已经清楚地分开了这些角色。

html,
body {
  height: 100%;
  margin: 0;
  border: solid magenta;
}

.row2 {
  background: #f8f9fa;
  margin-top: 20px;
  flex: 0 1 auto;
  -webkit-flex: 0 1 auto;
}

.container {
  display: flex;
  display: -webkit-flex;
  flex-flow: column;
  -webkit-flex-flow: column;
  height: 100%;
  border: solid blue;
}

.box {
  display: flex;
  flex-flow: column;
  height: 100%;
  border: solid blue;
}

.outsidebox {
  display: flex;
  flex-flow: column;
  height: 100%;
  border: solid purple;
}

.headerstyle {
  flex: 0 1 auto;
  border: solid green;
}

.contentstyle {
  flex: 1 1 auto;
  border: solid green;
}

.footerstyle {
  flex: 0 1 40px;
  border: solid green;
}

.wrapper {
  flex: 1 1 auto;
  border: solid yellow;
}
<div class="outsidebox">
  <div class="box">
    <div class="headerstyle">header</div>
    <div class="contentstyle">
      <div class="outsidebox">
        <div class="headerstyle">header 2</div>
        <div class="contentstyle">content 2</div>
        <div class="footerstyle">footer 2</div>
      </div>
    </div>
    <div class="footerstyle">footer</div>
  </div>
</div>

皮特

我想这就是您想要的-我已经使内容样式具有沿列方向的弹性,并且弹性增长,因此它填充了父容器:

* {box-sizing:border-box;}
html,
body {
  height: 100%;
  margin: 0;
  border: solid magenta;
}

.row2 {
  background: #f8f9fa;
  margin-top: 20px;
  flex: 0 1 auto;
  -webkit-flex: 0 1 auto;
}

.container {
  display: flex;
  display: -webkit-flex;
  flex-flow: column;
  -webkit-flex-flow: column;
  height: 100%;
  border: solid blue;
}

.box {
  display: flex;
  flex-flow: column;
  height: 100%;
  border: solid blue;
}

.outsidebox {
  flex-grow:1;
  display: flex;
  flex-flow: column;  
  height: 100%;
  border: solid purple;
}

.headerstyle {
  flex: 0 1 auto;
  border: solid green;
}

.contentstyle {
  flex-grow:1;
  display:flex;
  flex-direction:column;   /* make this flex and column */
  border: solid green;
  width:100%;
}

.footerstyle {
  flex: 0 1 40px;
  border: solid green;
}

.wrapper {
  flex: 1 1 auto;
  border: solid yellow;
}
<div class="outsidebox">
  <div class="box">
    <div class="headerstyle">header</div>
    <div class="contentstyle">
      <div class="outsidebox">
        <div class="headerstyle">header 2</div>
        <div class="contentstyle">content 2</div>
        <div class="footerstyle">footer 2</div>
      </div>
    </div>
    <div class="footerstyle">footer</div>
  </div>
</div>

或简化:

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  border: solid magenta;
}

.outsidebox {
  display: flex;
  flex-flow: column;
  flex-grow: 1;
  height: 100%;
  border: solid purple;
}

.headerstyle {
  flex: 0 1 auto;
  border: solid green;
}

.contentstyle {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  border: solid green;
  width: 100%;
}

.footerstyle {
  flex: 0 1 40px;
  border: solid green;
}
<div class="outsidebox">
  <div class="headerstyle">header</div>
  <div class="contentstyle">
    <div class="outsidebox">
      <div class="headerstyle">header 2</div>
      <div class="contentstyle">content 2</div>
      <div class="footerstyle">footer 2</div>
    </div>
  </div>
  <div class="footerstyle">footer</div>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么在方案中使用嵌套的lambda?

为什么我的导入无法在Chrome 67的EMCAScript 6中使用?

为什么在为Chrome应用程序编码时无法在routeProvider中使用controllerAs语法?

为什么在Java中使用静态嵌套接口?

为什么要在C ++中使用嵌套类?

Flexbox无法在Safari中使用

为什么元帅无法使用嵌套结构?

为什么Flexbox在非chrome浏览器中无法正常工作?

为什么videojs不能仅在Chrome中使用?

为什么在Chrome的`for`循环中使用`let`这么慢?

为什么按规则使用无法在Sass中使用?

为什么onClick()在Chrome浏览器上无法使用?

为什么POST无法在htaccess中使用某些重写条件?

为什么SumProduct无法在Excel VBA中使用

为什么Font Awesome无法在JSbin中使用?

为什么在 android 中使用 WebViewClient 时无法导航?

为什么在Mockito中使用doReturn无法获得价值

无法在方法中使用我的小部件Qcombobox,为什么?

为什么在compute()中使用时无法识别Vue函数?

为什么@OneToMany无法在Hibernate中使用继承

为什么我无法在Android中使用JsonArray检索数据?

为什么我的onload函数无法在JavaScript中使用?

为什么Android的代码无法在IOS中使用?

为什么Javascript无法在我的Flask应用中使用?

为什么我无法在Beautifulsoup中使用.text提取文本

为什么字典元素无法在python中使用max函数?

为什么JS设计模式片段无法在Sublime中使用

为什么我的背景色无法在ComboBox中使用

为什么在python中使用“regex”无法匹配汉字?