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

后端 未结 7 2412
再見小時候
再見小時候 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:15

    I think I found a solution. It works with lots of text and a little text. You don't need to specify the widths of anything, and it should work in IE8.

    .wrap1 {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      background: rgba(0, 0, 0, 0.5);
      overflow-y: auto;
    }
    .wrap2 {
      display: table;
      width: 100%;
      height: 100%;
      text-align: center;
    }
    .wrap3 {
      vertical-align: middle;
      display: table-cell;
    }
    .wrap4 {
      margin: 10px;
    }
    .dialog {
      text-align: left;
      background-color: white;
      padding: 5px;
      border-radius: 3px;
      margin: auto;
      display: inline-block;
      box-shadow: 2px 2px 4px rgba(0, 0, 0, .5);
    }

    Lorem ipsum dolor sit amet.

提交回复
热议问题