使用flexbox时,溢出属性在IE Edge和Firefox中不起作用

科滕

我下面的代码在Chrome和Safari中可以正常工作,但在IE EdgeFirefox中似乎不起作用(也不在IE11中,但这是不可能的)。

如果我不使用subheadernested-content本文中所述,那么它将在那些浏览器中正确呈现。但这决定了我的组件需要如何结构,我希望避免这种情况。

通过在Firefox和Edge上做更多的事情,这种工作方式会起作用吗?还是我需要重新考虑嵌套呢?

编辑:我的情况是这样的:在容器级别,我知道最大高度(它是动态计算并在“ Popover”组件中设置的)。但是我不能在子级中设置任何特定的最大高度,因为它们只是Popover的“内容”。而且我不想让整个.container列表都溢出nested-content

.container {
  display: flex;
  max-height: 140px;
  flex-direction: column;
  border: 1px solid red;
}
.header {
  background: lightgray;
}
.subheader {
  background: lightblue;
}
.content {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;  
}
.content > div {
  flex: 0 1 auto;
}
.nested-content {
  overflow: auto;
}
<div class="container">
  <div class="header">Header without specific height. Always stays at top of .container, even if it is so long it uses up two lines.</div>
  <div class="content">
    <div class="subheader">Subheader without specific height.</div>
    <div class="nested-content">
      <div>Item no 1 in long list</div>
      <div>Item no 2 in long list</div>
      <div>Item no 3 in long list</div>
      <div>Item no 4 in long list</div>
      <div>Item no 5 in long list</div>
      <div>Item no 6 in long list</div>
      <div>Item no 7 in long list</div>
      <div>Item no 8 in long list</div>
      <div>Item no 9 in long list</div>
      <div>Item no 10 in long list</div>
      <div>Item no 11 in long list</div>
      <div>Item no 12 in long list</div>
    </div>
  </div>
</div>

塔菲克·阿布·哈拉瓦(Tawfiq abu Halawah)

看看这个矮子是否适合您的情况https://plnkr.co/edit/12N6yofXXeUoTrG6tUuZ?p=preview

.container {
  display: flex;
  max-height: 140px;
  flex-direction: column;
  border: 1px solid red;
}
.header {
  background: lightgray;
}
.subheader {
  background: lightblue;
}

.content {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;  
  overflow:auto;
}
.content > div {
  flex: 0 1 auto;
}
.nested-content {
  overflow: auto;

}

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用flexbox时,溢出属性在IE Edge和Firefox中不起作用

来自分类Dev

溢出-y:滚动在 Firefox 和 Edge 中不起作用

来自分类Dev

Javascript在Firefox和IE / Edge中不起作用

来自分类Dev

使用flexbox和隐藏的溢出和滚动在Firefox中不起作用?

来自分类Dev

使用flexbox和隐藏的溢出和滚动在Firefox中不起作用?

来自分类Dev

CSS在Chrome / Firefox中不起作用(渲染)但在IE10 / Edge中起作用

来自分类Dev

CSS动画在IE和Edge中不起作用

来自分类Dev

隐藏的溢出在Firefox上不起作用,但在IE和chrome中起作用

来自分类Dev

Javascript下载在Firefox和IE中不起作用

来自分类Dev

document.execCommand在Firefox和IE中不起作用

来自分类Dev

CSS代码在Firefox和IE中不起作用

来自分类Dev

剪切路径在Firefox和IE中不起作用

来自分类Dev

Date.parse()在IE和FireFox中不起作用

来自分类Dev

scrollTop在Firefox和IE中不起作用

来自分类Dev

align =“ center”在Firefox和IE中不起作用

来自分类Dev

Rect x和y属性在Firefox中不起作用

来自分类Dev

css 背景属性在 chrome 和 firefox 中不起作用

来自分类Dev

具有表格和绝对定位功能的Flexbox在IE 10、11或Edge中不起作用

来自分类Dev

Python IIS在FireFox中不起作用,但在IE和Chrome中起作用

来自分类Dev

SVG转换属性在IE Edge中不起作用

来自分类Dev

Flexbox在Firefox中不起作用

来自分类Dev

为什么 css 在 Firefox 和 Chrome 中按预期工作时在 IE 中不起作用?

来自分类Dev

<table>中的Flex CSS属性在IE和Firefox上不起作用

来自分类Dev

localstorage 中的 JSON 数组在 IE 和 Edge 中不起作用

来自分类Dev

下载属性在Firefox中不起作用

来自分类Dev

IE CSS不起作用,但在Firefox中起作用

来自分类Dev

Edge和IE11中的CSS过渡不起作用

来自分类Dev

伪元素前后的 CSS 在 Edge 和 IE 11 中不起作用

来自分类Dev

与Firefox和IE中的Polymer一起使用时,ReCaptcha不起作用

Related 相关文章

  1. 1

    使用flexbox时,溢出属性在IE Edge和Firefox中不起作用

  2. 2

    溢出-y:滚动在 Firefox 和 Edge 中不起作用

  3. 3

    Javascript在Firefox和IE / Edge中不起作用

  4. 4

    使用flexbox和隐藏的溢出和滚动在Firefox中不起作用?

  5. 5

    使用flexbox和隐藏的溢出和滚动在Firefox中不起作用?

  6. 6

    CSS在Chrome / Firefox中不起作用(渲染)但在IE10 / Edge中起作用

  7. 7

    CSS动画在IE和Edge中不起作用

  8. 8

    隐藏的溢出在Firefox上不起作用,但在IE和chrome中起作用

  9. 9

    Javascript下载在Firefox和IE中不起作用

  10. 10

    document.execCommand在Firefox和IE中不起作用

  11. 11

    CSS代码在Firefox和IE中不起作用

  12. 12

    剪切路径在Firefox和IE中不起作用

  13. 13

    Date.parse()在IE和FireFox中不起作用

  14. 14

    scrollTop在Firefox和IE中不起作用

  15. 15

    align =“ center”在Firefox和IE中不起作用

  16. 16

    Rect x和y属性在Firefox中不起作用

  17. 17

    css 背景属性在 chrome 和 firefox 中不起作用

  18. 18

    具有表格和绝对定位功能的Flexbox在IE 10、11或Edge中不起作用

  19. 19

    Python IIS在FireFox中不起作用,但在IE和Chrome中起作用

  20. 20

    SVG转换属性在IE Edge中不起作用

  21. 21

    Flexbox在Firefox中不起作用

  22. 22

    为什么 css 在 Firefox 和 Chrome 中按预期工作时在 IE 中不起作用?

  23. 23

    <table>中的Flex CSS属性在IE和Firefox上不起作用

  24. 24

    localstorage 中的 JSON 数组在 IE 和 Edge 中不起作用

  25. 25

    下载属性在Firefox中不起作用

  26. 26

    IE CSS不起作用,但在Firefox中起作用

  27. 27

    Edge和IE11中的CSS过渡不起作用

  28. 28

    伪元素前后的 CSS 在 Edge 和 IE 11 中不起作用

  29. 29

    与Firefox和IE中的Polymer一起使用时,ReCaptcha不起作用

热门标签

归档