Can't scroll to top of flex item that is overflowing container

后端 未结 7 2396
再見小時候
再見小時候 2020-11-21 05:08

So, in attempting to make a useful modal using flexbox, I found what seems to be a browser issue and am wondering if there is a known fix or workaround -- or ideas on how to

7条回答
  •  独厮守ぢ
    2020-11-21 05:13

    I also managed to do it using extra container

    HTML

    
    

    CSS

    .modal-container {
      display: flex;
      justify-content: center;
      align-items: center;
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      background-color: black;
    }
    
    .modal {
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: #aaa;
      height: 80%;
      width: 90%;
    }
    
    .content-container {
      background-color: blue;
      max-height: 100%;
      overflow: auto;
      padding:0;
    }
    
    .content {
      display: flex;
      background-color: red;
      padding: 5px;
      width: 900px;
      height: 300px;
    }
    

    in jsfiddle > https://jsfiddle.net/Nash171/cpf4weq5/

    change .content width/height values and see

提交回复
热议问题