Grid beams
A hairline grid with short beams of colour running along its lines. CSS only.
On the grid.
A fine grid with beams of colour running along its lines.
Options
Code
import "./grid-beams.css";
export function GridBeams({ children }) {
return (
<section className="dh-beams">
<div className="dh-beams-art" aria-hidden="true">
<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
</div>
<div className="dh-beams-content">{children}</div>
</section>
);
}.dh-beams {
position: relative;
display: grid;
place-items: center;
overflow: hidden;
min-height: 720px;
background: var(--dh-bg, #fff);
color: var(--dh-fg, #171717);
font-size: 14px;
line-height: 1.5;
}
.dh-beams-art {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
/* The drawing takes this colour. */
color: var(--dh-accent, #2563ff);
pointer-events: none;
-webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 35%, transparent 100%);
mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 35%, transparent 100%);
}
.dh-beams-art {
--dh-beams-cell: 48px;
--dh-beams-line: color-mix(in srgb, var(--dh-fg, #171717) 9%, transparent);
background-image:
linear-gradient(to right, var(--dh-beams-line) 1px, transparent 1px),
linear-gradient(to bottom, var(--dh-beams-line) 1px, transparent 1px);
background-size: var(--dh-beams-cell) var(--dh-beams-cell);
}
/* Each beam sits on a grid line: --at is which line, counted from the edge. */
.dh-beams-art i {
position: absolute;
top: -140px;
left: calc(var(--dh-beams-cell) * var(--at));
width: 1px;
height: 140px;
background: linear-gradient(to bottom, transparent, currentColor);
animation: dh-beams-down var(--time, 6s) linear var(--wait, 0s) infinite;
}
.dh-beams-art i:nth-child(even) {
top: calc(var(--dh-beams-cell) * var(--at));
left: -140px;
width: 140px;
height: 1px;
background: linear-gradient(to right, transparent, currentColor);
animation-name: dh-beams-across;
}
.dh-beams-art i:nth-child(1) { --at: 4; --time: 6s; --wait: -1s; }
.dh-beams-art i:nth-child(2) { --at: 3; --time: 9s; --wait: -4s; }
.dh-beams-art i:nth-child(3) { --at: 9; --time: 7s; --wait: -5s; }
.dh-beams-art i:nth-child(4) { --at: 6; --time: 11s; --wait: -2s; }
.dh-beams-art i:nth-child(5) { --at: 14; --time: 5s; --wait: -3s; }
.dh-beams-art i:nth-child(6) { --at: 8; --time: 8s; --wait: -7s; }
.dh-beams-art i:nth-child(7) { --at: 20; --time: 8s; --wait: -6s; }
.dh-beams-art i:nth-child(8) { --at: 1; --time: 10s; --wait: -9s; }
@keyframes dh-beams-down {
to { transform: translateY(900px); }
}
@keyframes dh-beams-across {
to { transform: translateX(1800px); }
}
@media (prefers-reduced-motion: reduce) {
.dh-beams-art i { display: none; }
}
.dh-beams-content {
position: relative;
isolation: isolate;
padding: 32px;
text-align: center;
}
/* A soft clearing behind the words, so they stay easy to read. */
.dh-beams-content::before {
content: "";
position: absolute;
inset: -24px -96px;
z-index: -1;
background: radial-gradient(closest-side, var(--dh-bg, #fff) 45%, transparent);
}
.dh-beams h1 {
margin: 0;
font-size: 44px;
font-weight: 500;
line-height: 1.08;
letter-spacing: -0.04em;
}
.dh-beams p {
max-width: 360px;
margin: 14px auto 0;
color: var(--dh-muted, #6b6b6b);
font-size: 15px;
}
@media (max-width: 640px) {
.dh-beams h1 { font-size: 32px; }
}<section class="dh-beams">
<div class="dh-beams-art" aria-hidden="true">
<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
</div>
<div class="dh-beams-content">
<h1>On the grid.</h1>
<p>A fine grid with beams of colour running along its lines.</p>
</div>
</section>.dh-beams {
position: relative;
display: grid;
place-items: center;
overflow: hidden;
min-height: 720px;
background: var(--dh-bg, #fff);
color: var(--dh-fg, #171717);
font-size: 14px;
line-height: 1.5;
}
.dh-beams-art {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
/* The drawing takes this colour. */
color: var(--dh-accent, #2563ff);
pointer-events: none;
-webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 35%, transparent 100%);
mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 35%, transparent 100%);
}
.dh-beams-art {
--dh-beams-cell: 48px;
--dh-beams-line: color-mix(in srgb, var(--dh-fg, #171717) 9%, transparent);
background-image:
linear-gradient(to right, var(--dh-beams-line) 1px, transparent 1px),
linear-gradient(to bottom, var(--dh-beams-line) 1px, transparent 1px);
background-size: var(--dh-beams-cell) var(--dh-beams-cell);
}
/* Each beam sits on a grid line: --at is which line, counted from the edge. */
.dh-beams-art i {
position: absolute;
top: -140px;
left: calc(var(--dh-beams-cell) * var(--at));
width: 1px;
height: 140px;
background: linear-gradient(to bottom, transparent, currentColor);
animation: dh-beams-down var(--time, 6s) linear var(--wait, 0s) infinite;
}
.dh-beams-art i:nth-child(even) {
top: calc(var(--dh-beams-cell) * var(--at));
left: -140px;
width: 140px;
height: 1px;
background: linear-gradient(to right, transparent, currentColor);
animation-name: dh-beams-across;
}
.dh-beams-art i:nth-child(1) { --at: 4; --time: 6s; --wait: -1s; }
.dh-beams-art i:nth-child(2) { --at: 3; --time: 9s; --wait: -4s; }
.dh-beams-art i:nth-child(3) { --at: 9; --time: 7s; --wait: -5s; }
.dh-beams-art i:nth-child(4) { --at: 6; --time: 11s; --wait: -2s; }
.dh-beams-art i:nth-child(5) { --at: 14; --time: 5s; --wait: -3s; }
.dh-beams-art i:nth-child(6) { --at: 8; --time: 8s; --wait: -7s; }
.dh-beams-art i:nth-child(7) { --at: 20; --time: 8s; --wait: -6s; }
.dh-beams-art i:nth-child(8) { --at: 1; --time: 10s; --wait: -9s; }
@keyframes dh-beams-down {
to { transform: translateY(900px); }
}
@keyframes dh-beams-across {
to { transform: translateX(1800px); }
}
@media (prefers-reduced-motion: reduce) {
.dh-beams-art i { display: none; }
}
.dh-beams-content {
position: relative;
isolation: isolate;
padding: 32px;
text-align: center;
}
/* A soft clearing behind the words, so they stay easy to read. */
.dh-beams-content::before {
content: "";
position: absolute;
inset: -24px -96px;
z-index: -1;
background: radial-gradient(closest-side, var(--dh-bg, #fff) 45%, transparent);
}
.dh-beams h1 {
margin: 0;
font-size: 44px;
font-weight: 500;
line-height: 1.08;
letter-spacing: -0.04em;
}
.dh-beams p {
max-width: 360px;
margin: 14px auto 0;
color: var(--dh-muted, #6b6b6b);
font-size: 15px;
}
@media (max-width: 640px) {
.dh-beams h1 { font-size: 32px; }
}Grid beams is not in the Figma file yet.
Use the React or HTML code for now.