Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created March 4, 2026 08:01
Show Gist options
  • Select an option

  • Save Kcko/8ad783e062bc0c00ba63fadf50cff406 to your computer and use it in GitHub Desktop.

Select an option

Save Kcko/8ad783e062bc0c00ba63fadf50cff406 to your computer and use it in GitHub Desktop.
/* Grid Table */
.gridTable {
display: grid;
border-collapse: collapse;
width: 100%;
grid-template-columns: repeat(3, auto);
border: #36304a solid 1px;
background: #fff;
border-radius: 10px;
overflow: hidden;
margin: 0;
position: relative;
}
.gridTable > div { /* Table header & body */
display: grid;
grid-column: 1 / -1;
grid-template-columns: subgrid;
padding: 0.25em 0;
}
.gridTable > div:first-child { /* Table header */
align-items: center;
height: 60px;
background: #36304a;
color: #fff;
padding: 0 8px;
}
.gridTable > div:nth-child(2) { /* Table body */
display: contents;
}
.gridTable > div:nth-child(2) > * { /* Table body row */
display: grid;
grid-column: 1 / -1;
grid-template-columns: subgrid;
padding: 4px;
}
.gridTable > div:nth-child(2) > *:nth-child(odd) { /* Table body row */
background: #f7f7f7;
}
.gridTable > div:nth-child(2) > *:hover { /* Table body row */
background-color: #f0f0f0;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<html>
<body>
<div class="gridTable">
<div> <!-- Header -->
<div>Timeclock.Kiwi</div>
<div>Payroll</div>
<div>Checked</div>
</div>
<div> <!-- Body -->
<div>
<div>Cat</div>
<div>In</div>
<div>Hat</div>
</div>
<div>
<div>Cat</div>
<div>In</div>
<div>Hat</div>
</div>
<div>
<div>Cat</div>
<div>In</div>
<div>Hat</div>
</div>
<div>
<div>Cat</div>
<div>In</div>
<div>Hat</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment