AI CSS Animations

Glass Table

A frosted orders table with avatars, status pills and tabular amounts over drifting color. Rows light up on hover, and the newest order glows on a loop beside a live dot. A real table element.

Also known as: glassmorphism table css, frosted data table css, glass table html css.

Recent orders

View all
CustomerStatusAmount
Ava ChenPaid$248.00
Leo ParkPending$89.50
Maya RossPaid$1,020.00
Sam DiazRefunded$64.00

HTML

<div class="gls-glass-table">
  <span class="gls-glass-table-orb gls-glass-table-orb-a" aria-hidden="true"></span>
  <span class="gls-glass-table-orb gls-glass-table-orb-b" aria-hidden="true"></span>
  <article class="gls-glass-table-card">
    <div class="gls-glass-table-head">
      <p class="gls-glass-table-title"><i class="gls-glass-table-live" aria-hidden="true"></i>Recent orders</p>
      <a class="gls-glass-table-all" href="#">View all</a>
    </div>
    <table class="gls-glass-table-table">
      <thead>
        <tr><th scope="col">Customer</th><th scope="col">Status</th><th scope="col">Amount</th></tr>
      </thead>
      <tbody>
        <tr><td><span class="gls-glass-table-who"><i class="gls-glass-table-avatar" aria-hidden="true"></i>Ava Chen</span></td><td><span class="gls-glass-table-pill gls-glass-table-paid">Paid</span></td><td>$248.00</td></tr>
        <tr><td><span class="gls-glass-table-who"><i class="gls-glass-table-avatar" aria-hidden="true"></i>Leo Park</span></td><td><span class="gls-glass-table-pill gls-glass-table-pending">Pending</span></td><td>$89.50</td></tr>
        <tr><td><span class="gls-glass-table-who"><i class="gls-glass-table-avatar" aria-hidden="true"></i>Maya Ross</span></td><td><span class="gls-glass-table-pill gls-glass-table-paid">Paid</span></td><td>$1,020.00</td></tr>
        <tr><td><span class="gls-glass-table-who"><i class="gls-glass-table-avatar" aria-hidden="true"></i>Sam Diaz</span></td><td><span class="gls-glass-table-pill gls-glass-table-refund">Refunded</span></td><td>$64.00</td></tr>
      </tbody>
    </table>
  </article>
</div>

CSS

.gls-glass-table {
  --c: var(--gls-color, #3b82f6);
  font-size: var(--gls-size, 16px);
  position: relative;
  display: grid;
  place-items: center;
  width: 22em;
  height: 12em;
  border-radius: 1.25em;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 35%, #0b1020), color-mix(in srgb, var(--c) 25%, #1e1b4b));
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.3;
}
.gls-glass-table-orb {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
}
.gls-glass-table-orb-a {
  left: 1.5em;
  top: 0.2em;
  width: 7em;
  height: 7em;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 40%, #fff), var(--c));
  animation: gls-glass-table-drift-a 9s ease-in-out infinite alternate;
}
.gls-glass-table-orb-b {
  right: 1.5em;
  bottom: 0;
  width: 6em;
  height: 6em;
  background: linear-gradient(135deg, #fde68a, #f472b6);
  animation: gls-glass-table-drift-b 11s ease-in-out infinite alternate;
}
.gls-glass-table-card {
  width: 17.5em;
  padding: 0.7em 0.7em 0.55em;
  border-radius: 1.2em;
  background: color-mix(in srgb, #fff 14%, transparent);
  -webkit-backdrop-filter: blur(0.9em) saturate(1.5);
  backdrop-filter: blur(0.9em) saturate(1.5);
  border: 1px solid color-mix(in srgb, #fff 45%, transparent);
  box-shadow: 0 0.5em 1.5em -0.5em rgb(0 0 0 / 0.35), inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent);
}
.gls-glass-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.35em 0.5em;
}
.gls-glass-table-title {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0;
  font-size: 0.74em;
  font-weight: 700;
}
.gls-glass-table-live {
  position: relative;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: #4ade80;
}
.gls-glass-table-live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #4ade80;
  animation: gls-glass-table-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.gls-glass-table-all {
  color: rgb(255 255 255 / 0.8);
  font-size: 0.62em;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}
.gls-glass-table-all:hover { color: #fff; text-decoration: underline; }
.gls-glass-table-all:focus-visible { outline: 2px solid #fff; outline-offset: 0.15em; }
.gls-glass-table-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.12em;
  font-variant-numeric: tabular-nums;
}
.gls-glass-table-table th {
  padding: 0 0.7em 0.6em;
  border-bottom: 1px solid rgb(255 255 255 / 0.22);
  color: rgb(255 255 255 / 0.7);
  font-size: 0.5em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}
.gls-glass-table-table td {
  padding: 0.4em 0.53em;
  font-size: 0.66em;
  white-space: nowrap;
  transition: background-color 0.25s ease;
}
.gls-glass-table-table th:last-child,
.gls-glass-table-table td:last-child { text-align: right; }
.gls-glass-table-table td:first-child { border-radius: 0.7em 0 0 0.7em; }
.gls-glass-table-table td:last-child { border-radius: 0 0.7em 0.7em 0; font-weight: 650; }
.gls-glass-table-table tbody tr:hover td { background-color: rgb(255 255 255 / 0.15); }
.gls-glass-table-table tbody tr:first-child td { animation: gls-glass-table-new 4.5s ease-in-out infinite; }
.gls-glass-table-who {
  display: flex;
  align-items: center;
  gap: 0.55em;
  font-weight: 600;
}
.gls-glass-table-avatar {
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.25);
}
.gls-glass-table-table tbody tr:nth-child(1) .gls-glass-table-avatar { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 40%, #fff), var(--c)); }
.gls-glass-table-table tbody tr:nth-child(2) .gls-glass-table-avatar { background: linear-gradient(135deg, #fde68a, #f472b6); }
.gls-glass-table-table tbody tr:nth-child(3) .gls-glass-table-avatar { background: linear-gradient(135deg, #5eead4, #6366f1); }
.gls-glass-table-table tbody tr:nth-child(4) .gls-glass-table-avatar { background: linear-gradient(135deg, #fdba74, #a855f7); }
.gls-glass-table-pill {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 99em;
  font-size: 0.85em;
  font-weight: 700;
}
.gls-glass-table-paid { background: rgb(34 197 94 / 0.3); color: #dcfce7; box-shadow: inset 0 0 0 1px rgb(74 222 128 / 0.45); }
.gls-glass-table-pending { background: rgb(245 158 11 / 0.3); color: #fef3c7; box-shadow: inset 0 0 0 1px rgb(251 191 36 / 0.45); }
.gls-glass-table-refund { background: rgb(244 63 94 / 0.3); color: #ffe4e6; box-shadow: inset 0 0 0 1px rgb(251 113 133 / 0.45); }
@keyframes gls-glass-table-new {
  0%, 55%, 100% { background-color: transparent; }
  12%, 30% { background-color: color-mix(in srgb, var(--c) 40%, transparent); }
}
@keyframes gls-glass-table-ping {
  75%, 100% { transform: scale(2.4); opacity: 0; }
}
@keyframes gls-glass-table-drift-a {
  to { transform: translate(4em, 1.5em) scale(1.1); }
}
@keyframes gls-glass-table-drift-b {
  to { transform: translate(-4em, -1.5em) scale(0.9); }
}

@media (prefers-reduced-motion: reduce) {
  .gls-glass-table, .gls-glass-table *, .gls-glass-table::before, .gls-glass-table::after, .gls-glass-table *::before, .gls-glass-table *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --gls-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --gls-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar glass effects