1

I am using display flex for an element (.outer) which should adjust its height to the content but must not exceed a certain height (e.g. 100px).

Once the height is exceeded I want that the content inside to start to scroll vertically.

This behaviour works as expected on Chrome and it was solved in my other stackoverflow post using Firefox, but in IE11 the content wrapper(.wrapper) still growth to the height of its content (.list) and therefore it is not scrollable.

You can try it yourself using this simplified example:

.outer {
  display: flex;
  max-height: 100px;
  overflow: hidden;
  flex-direction: column;
}

.wrapper {
  display: flex;
  width: 100%;
  min-height: 0;
  height: 100%;
}

.list {
  width: 100%;
  background: purple;
  overflow: scroll;
}
  <div class="outer">
    <div class="wrapper">

      <div class="list">
        <p>1</p>
        <p>2</p>
        <p>3</p>
        <p>4</p>
        <p>5</p>
      </div>

    </div>

  </div>

Setting max-height to height solves the scroll problem but causes a white space if the content is not high enough.

Talie
  • 51
  • 6
  • Maybe you need to refresh the browser. I see no whitespace with `height` in either IE11, FF, Chrome and Edge, even with all `

    ` removed

    – Rene van der Lende Jul 31 '17 at 14:41
  • @RenevanderLende thanks for your comment :) setting a height would not help in my case. In my extended version of this problem, I have a box, which needs to have a auto height to prevent a white space. This case is not reproduce able in my simplified example, sorry for the confusion. – Talie Jul 31 '17 at 22:08
  • Add `::before,::after,* { outline: 1px dashed }` to your CSS. The outlines may help you to figure out what is happening. I use this all the time when I need to see what the boxes are doing... – Rene van der Lende Aug 01 '17 at 00:35

0 Answers0