【问题标题】:React Table is over SideBarReact Table 在 SideBar 上方
【发布时间】:2022-02-10 17:34:48
【问题描述】:

边栏、div 或表格上是否有任何 css 属性,我在打开时将我的内容发送到边栏下方?

我正在使用 react-data-table-component。

侧边栏上的数据表:

数据表 CSS:

#RTable-7 {
    text-align: center;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    border: 3px solid #ddd;
    width: 100%;
}

#RTable-7 td, #RTable-7 th {
    border: 1px solid #ddd;
    padding: 8px;
}

#RTable-7 tr:nth-child(even){background-color: #f2f2f2;}

#RTable-7 tr:hover {
    /* background-color: #ddd; */
    background-color: #eea2a2;
}

#RTable-7 th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #4CAF50;
    color: white;
}

侧边栏 CSS:

.navbar {
    background-color: #060b26;
    height: 80px;
    display: flex;
    justify-content: start;
    align-items: center;
}

.nav-menu {
    background-color: #060b26;
    width: 250px;
    height: 100vh;
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    left: -100%;
    transition: 850ms;
}
  
.nav-menu.active {
    left: 0;
    transition: 350ms;
    position: absolute;
}

【问题讨论】:

    标签: css reactjs react-data-table-component


    【解决方案1】:

    您需要给.nav-menuz-index 值赋予一个高于表格的值。试试这个

    .nav-menu {
        z-index: 10 !important; // increase it if 10 doesn't work
    }
    

    【讨论】:

    • 哈哈,真是个好建议,谢谢,z-index 必须在 .nav-menu.active 类中,但它的方向是正确的,所以谢谢。
    猜你喜欢
    • 2017-09-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 2020-12-09
    • 2012-05-11
    • 2020-06-15
    • 1970-01-01
    • 2022-06-14
    相关资源
    最近更新 更多