DEV Community

Fersho Pls
Fersho Pls

Posted on

CSS tabla con filas y columnas fijas

<div class="table-sticky">
  <table>
  </table>
</div>
Enter fullscreen mode Exit fullscreen mode
.table-sticky {
    overflow-y: auto;
    max-height: 95vh;
}

.table-sticky table {
    table-layout: fixed;
    position: relative;
}

.table-sticky th {
    position: sticky;
    top: 0;
}

.table-sticky th:nth-child(1) {
    z-index: 1;
}

.table-sticky th:nth-child(1),
.table-sticky td:nth-child(1) {
    position: sticky;
    left: 0;
    background-color: white;
}

.table-sticky th,
.table-sticky td {
    background-color: white;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)