Back to CSS Button Groups Subgrid Beam Pure CSS
Share
HTML
<div class="cbgp-beam" role="group" aria-label="Document actions">
  <button type="button">Edit</button>
  <button type="button">Duplicate</button>
  <button type="button">Archive</button>
</div>
CSS
.cbgp-beam {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  position: relative;
  background: rgba(8,10,18,0.85);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 22px rgba(0,0,0,0.45);
}
.cbgp-beam::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 33.333%; height: 2px;
  background: linear-gradient(90deg, transparent, #00ffe0 30%, #ff5af1 70%, transparent);
  filter: blur(0.4px);
  transition: transform 0.45s cubic-bezier(.65,0,.35,1);
  pointer-events: none;
}
.cbgp-beam button {
  padding: 11px 18px;
  border: 0; cursor: pointer;
  background: transparent;
  color: rgba(220,225,230,0.65);
  font: 600 12px/1 ui-sans-serif, system-ui;
  letter-spacing: 0.04em;
  transition: color 0.25s, background 0.25s;
}
.cbgp-beam button + button { border-left: 1px solid rgba(255,255,255,0.04); }
.cbgp-beam button:hover { color: #fff; background: rgba(0,255,224,0.04); }
.cbgp-beam:has(button:nth-child(2):hover)::before { transform: translateX(100%); }
.cbgp-beam:has(button:nth-child(3):hover)::before { transform: translateX(200%); }
.cbgp-beam button:focus-visible { outline: 2px solid #00ffe0; outline-offset: -2px; }