粘滞表标题滚动问题

时间:2020-06-24 18:56:28

标签: css reactjs html-table

您好,我遇到了粘性标头问题。我有三列,但最后一列,当我滚动时,数据决定与我的标题重叠。我不确定为什么要这么做。预先感谢!

问题的屏幕截图: enter image description here

我的CSS代码:

.Job-Report-Table {
      position: relative;
      display: flex;
      border-bottom: 2px solid #414141;
      max-height: 450px;
      overflow-y: scroll;
      thead th {
        position: sticky;
        top: 0;
      }
      .table {
        .tableHeader {
          font-size: 16px;
          color: #414141;
          // background-color: #d8d8d8;
          .cell-1 {
            background-color: #5b5b5b;
            color: #ffffff;
            vertical-align: middle;
          }
          .cell-2 {
            vertical-align: middle;
            background-color: #d8d8d8;
          }
          .cell-3 {
            vertical-align: middle;
            background-color: #d8d8d8;
          }
     }
}

1 个答案:

答案 0 :(得分:1)

z-index特权。

您应将z-index上的thead th设置为适当的(较高)值。如果没有指定其他z-index值,则1就足够了。