Back to CSS Neon Infinite Neon Grid CSS + JS
Share
HTML
<section class="nn-grd" aria-label="Infinite neon grid demo">
  <div class="scene">

    <div class="bracket bracket-tl" aria-hidden="true"></div>
    <div class="bracket bracket-tr" aria-hidden="true"></div>
    <div class="bracket bracket-bl" aria-hidden="true"></div>
    <div class="bracket bracket-br" aria-hidden="true"></div>

    <div class="sky" aria-hidden="true"></div>
    <div class="stars" data-nn-grd-stars aria-hidden="true"></div>

    <div class="hud-panel hud-left" aria-hidden="true">
      <div class="hud-row">GRID <span class="hud-val ok">ONLINE</span></div>
      <div class="hud-row">LAT <span class="hud-val ok">24.6°N</span></div>
      <div class="hud-row">ALT <span class="hud-val warn">⚠ LOW</span></div>
    </div>

    <div class="hud-panel hud-right" aria-hidden="true">
      <div class="hud-row">SIGNAL <span class="hud-val ok">94%</span></div>
      <div class="hud-row">SYNC <span class="hud-val ok">LOCK</span></div>
      <div class="hud-row">NODE <span class="hud-val warn">7/12</span></div>
    </div>

    <div class="horizon" aria-hidden="true"></div>

    <div class="grid-stage" aria-hidden="true">
      <div class="grid-plane"></div>
      <div class="grid-fade-h"></div>
      <div class="grid-fade-v"></div>
    </div>

    <div class="center-title">
      <div class="title-main">GRIDZONE</div>
      <div class="title-sub">SECTOR 7 · ONLINE</div>
    </div>

  </div>
</section>
CSS
/* ─── 11 Infinite Neon Grid — seamless 3D perspective floor ────── */
@import url('https://fonts.googleapis.com/css2?family=Audiowide&family=Oxanium:wght@800&display=swap');

.nn-grd {
  position: relative;
  width: 100%;
  min-height: 600px;
  background: #04000e;
  font-family: 'Audiowide', cursive;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: hidden;
  box-sizing: border-box;
}

.nn-grd *,
.nn-grd *::before,
.nn-grd *::after { box-sizing: border-box; margin: 0; padding: 0; }

.nn-grd .scene {
  position: relative;
  width: 800px;
  max-width: 100%;
  height: 520px;
  overflow: hidden;
}

.nn-grd .sky {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(180deg,
    #04000e 0%,
    #0d0020 40%,
    #1a003a 80%,
    #220050 100%
  );
}

.nn-grd .stars { position: absolute; inset: 0 0 45% 0; overflow: hidden; }
.nn-grd .star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: nn-grd-twinkle var(--d, 2s) var(--dl, 0s) ease-in-out infinite alternate;
}
@keyframes nn-grd-twinkle {
  from { opacity: var(--min, 0.25); }
  to   { opacity: 1; transform: scale(1.5); }
}

.nn-grd .horizon {
  position: absolute;
  left: -20%;
  right: -20%;
  top: 52%;
  height: 6px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0,255,210,0.4) 15%,
    #00fff2 35%,
    #ff00ff 50%,
    #00fff2 65%,
    rgba(0,255,210,0.4) 85%,
    transparent 100%
  );
  box-shadow:
    0 0 24px rgba(0,255,240,0.8),
    0 0 60px rgba(0,255,240,0.4),
    0 0 120px rgba(0,200,255,0.2),
    0 -8px 30px rgba(0,255,240,0.15),
    0  8px 30px rgba(0,255,240,0.15);
  z-index: 5;
  animation: nn-grd-horizon 3s ease-in-out infinite;
}
@keyframes nn-grd-horizon {
  0%, 100% { opacity: 1; filter: blur(0px); }
  50%      { opacity: 0.85; filter: blur(0.5px); }
}

.nn-grd .grid-stage {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 53%;
  perspective: 280px;
  perspective-origin: 50% 0%;
  overflow: hidden;
}
.nn-grd .grid-plane {
  position: absolute;
  top: 0;
  left: -30%;
  right: -30%;
  height: 280%;
  transform-origin: top center;
  transform: rotateX(58deg);
  background-image:
    linear-gradient(rgba(0,255,230,0.9) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,255,230,0.9) 2px, transparent 2px),
    linear-gradient(rgba(255,0,240,0.4) 3px, transparent 3px),
    linear-gradient(90deg, rgba(255,0,240,0.4) 3px, transparent 3px);
  background-size:
    70px 70px,
    70px 70px,
    350px 350px,
    350px 350px;
  background-position: 0 0, 0 0, 0 0, 0 0;
  animation: nn-grd-move 1.2s linear infinite;
}
@keyframes nn-grd-move {
  from { background-position: 0 0,    0 0,    0 0,    0 0; }
  to   { background-position: 0 70px, 0 70px, 0 70px, 0 70px; }
}
.nn-grd .grid-fade-h {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, #04000e 100%);
  pointer-events: none;
  z-index: 2;
}
.nn-grd .grid-fade-v {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(4,0,14,0.92) 0%,
    transparent 18%,
    transparent 82%,
    rgba(4,0,14,0.92) 100%
  );
  pointer-events: none;
  z-index: 2;
}

.nn-grd .hud-panel {
  position: absolute;
  border: 1px solid;
  padding: 8px 14px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  z-index: 10;
  backdrop-filter: blur(4px);
  animation: nn-grd-hud 4s ease-in-out infinite;
}
.nn-grd .hud-left {
  left: 24px;
  top: 30%;
  border-color: rgba(0,255,230,0.35);
  color: rgba(0,255,230,0.7);
  background: rgba(0,40,40,0.4);
  box-shadow: 0 0 14px rgba(0,255,230,0.15), inset 0 0 10px rgba(0,255,230,0.05);
  animation-delay: 0s;
}
.nn-grd .hud-right {
  right: 24px;
  top: 30%;
  border-color: rgba(255,0,240,0.35);
  color: rgba(255,0,240,0.7);
  background: rgba(40,0,40,0.4);
  box-shadow: 0 0 14px rgba(255,0,240,0.15), inset 0 0 10px rgba(255,0,240,0.05);
  animation-delay: 1.5s;
}
@keyframes nn-grd-hud {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.nn-grd .hud-row { display: flex; justify-content: space-between; gap: 20px; line-height: 2; }
.nn-grd .hud-val { font-family: 'Audiowide', cursive; }
.nn-grd .hud-val.ok   { color: #00fff2; text-shadow: 0 0 6px #00fff2; }
.nn-grd .hud-val.warn { color: #ff0090; text-shadow: 0 0 6px #ff0090; }

.nn-grd .center-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 80px;
  z-index: 8;
  pointer-events: none;
}
.nn-grd .title-main {
  font-family: 'Oxanium', sans-serif;
  font-size: 60px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #fff;
  text-shadow:
    0 0 6px #fff,
    0 0 16px #00fff2,
    0 0 36px #00fff2,
    0 0 72px rgba(0,200,255,0.6),
    0 0 120px rgba(0,150,255,0.3);
  animation: nn-grd-flicker 7s ease-in-out infinite;
}
@keyframes nn-grd-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.08; }
  94% { opacity: 1; }
  96% { opacity: 0.1; }
  97% { opacity: 1; }
}
.nn-grd .title-sub {
  font-family: 'Audiowide', cursive;
  font-size: 11px;
  letter-spacing: 0.6em;
  color: rgba(0,255,240,0.65);
  text-shadow: 0 0 10px rgba(0,255,240,0.5);
  margin-top: 6px;
}

.nn-grd .bracket {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: rgba(0,255,230,0.5);
  border-style: solid;
  z-index: 10;
}
.nn-grd .bracket-tl { top: 12px;    left: 12px;  border-width: 1.5px 0 0 1.5px; }
.nn-grd .bracket-tr { top: 12px;    right: 12px; border-width: 1.5px 1.5px 0 0; }
.nn-grd .bracket-bl { bottom: 12px; left: 12px;  border-width: 0 0 1.5px 1.5px; }
.nn-grd .bracket-br { bottom: 12px; right: 12px; border-width: 0 1.5px 1.5px 0; }

@media (max-width: 720px) {
  .nn-grd .scene { height: 400px; }
  .nn-grd .title-main { font-size: 40px; }
  .nn-grd .hud-panel { font-size: 8px; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .nn-grd .star,
  .nn-grd .grid-plane,
  .nn-grd .horizon,
  .nn-grd .hud-panel,
  .nn-grd .title-main { animation: none !important; }
}
JS
(() => {
  // Scoped star injection — finds the stars container inside .nn-grd
  // only. Multiple instances on the same page each populate their
  // own starfield independently.
  const root = document.querySelector('.nn-grd');
  if (!root) return;
  const stars = root.querySelector('[data-nn-grd-stars]');
  if (!stars || stars.childElementCount > 0) return;
  for (let i = 0; i < 100; i++) {
    const s = document.createElement('div');
    s.className = 'star';
    const sz = Math.random() * 2 + 0.5;
    s.style.cssText =
      'width:' + sz + 'px;' +
      'height:' + sz + 'px;' +
      'left:' + (Math.random() * 100) + '%;' +
      'top:' + (Math.random() * 100) + '%;' +
      '--d:' + (Math.random() * 2.5 + 1).toFixed(2) + 's;' +
      '--dl:' + (Math.random() * 3).toFixed(2) + 's;' +
      '--min:' + (Math.random() * 0.2 + 0.1).toFixed(2) + ';';
    stars.appendChild(s);
  }
})();