Custom CSS docs · Recipes

Custom CSS

Recipes

Looks to copy into the CSS tab. Each one uses your Look colours.

Paste any of these into the CSS tab. Mix as many as you like.

Gradient buttons

The same page twice, with buttons fading from lilac on a dark indigo background, and from lime on a dark green one.

With two different button colours.

:is([data-part="link"], [data-part="social"]) {
  border-color: transparent;
  background: linear-gradient(
    135deg,
    var(--linker-button),
    color-mix(in oklab, var(--linker-button), var(--linker-bg) 45%)
  );
  background-origin: border-box;
  color: var(--linker-button-text);
}

:is([data-part="link"], [data-part="social"]):is(:hover, :focus-visible, [data-demo]) {
  background: var(--linker-button);
}

Frosted glass

A page with a purple glow behind translucent, frosted buttons with light borders.

Over a glow of the button colour.

:root {
  background-image:
    radial-gradient(
      circle at 20% 10%,
      color-mix(in oklab, var(--linker-button) 60%, transparent),
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 75%,
      color-mix(in oklab, var(--linker-button) 35%, transparent),
      transparent 40%
    );
}

:is([data-part="link"], [data-part="social"]) {
  border-color: color-mix(in oklab, var(--linker-text) 25%, transparent);
  background: color-mix(in oklab, var(--linker-text) 10%, transparent);
  color: var(--linker-text);
  backdrop-filter: blur(16px) saturate(1.4);
}

:is([data-part="link"], [data-part="social"]):is(:hover, :focus-visible, [data-demo]) {
  background: color-mix(in oklab, var(--linker-text) 18%, transparent);
}

Have a background picture? Leave out the :root rule.

Brutalist

A pale yellow page with square yellow buttons, thick black borders and hard black shadows; the first button is shown hovered, lifted up and to the left.

The first button is hovered.

:root {
  --linker-radius: 0;
}

:is([data-part="link"], [data-part="social"]) {
  border: 3px solid var(--linker-text);
  background: var(--linker-button);
  color: var(--linker-button-text);
  box-shadow: 5px 5px 0 var(--linker-text);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

:is([data-part="link"], [data-part="social"]):is(:hover, :focus-visible, [data-demo]) {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--linker-text);
}

:is([data-part="link"], [data-part="social"]):active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--linker-text);
}

[data-part="avatar"] {
  border: 3px solid var(--linker-text);
  border-radius: 0;
}

Retro

A dark page with green monospace text, faint horizontal scanlines, and green buttons with stepped pixel corners.

With green colours from the Look tab.

:root {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  background-image: repeating-linear-gradient(
    to bottom,
    color-mix(in oklab, var(--linker-text) 7%, transparent) 0 1px,
    transparent 1px 4px
  );
}

/* Square buttons with stepped corners, drawn by four hard shadows. */
:is([data-part="link"], [data-part="social"]) {
  border-radius: 0;
  border-color: var(--linker-button);
  background: var(--linker-button);
  color: var(--linker-button-text);
  box-shadow:
    0 -3px 0 var(--linker-text),
    0 3px 0 var(--linker-text),
    -3px 0 0 var(--linker-text),
    3px 0 0 var(--linker-text);
}

[data-part="name"]::after {
  content: "_";
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

Gradient name

A page whose name, Alice, is large and bold and fades from white at the top to pink at the bottom.

From the text colour to a pink button colour.

[data-part="name"] {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to bottom, var(--linker-text) 25%, var(--linker-button) 85%);
  background-clip: text;
  color: transparent;
}

A page whose first button, My Bluesky, is ringed and bold, with a small white NEW tag on its top right edge.

On a link in the spotlight.

[data-part="link"][data-spotlight]::before {
  content: "New";
  position: absolute;
  top: -0.6rem;
  right: 0.75rem;
  border-radius: 999px;
  background: var(--linker-text);
  padding: 0.1rem 0.5rem;
  color: var(--linker-bg);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

Change "New" to any short word.

A light page for light mode

Light colours for visitors in light mode; your Look colours otherwise.

The same page twice: dark with white buttons for a visitor in dark mode, and cream with near-black buttons for a visitor in light mode.

The same page, as two visitors see it.

@media (prefers-color-scheme: light) {
  :root {
    --linker-bg: #faf7f2;
    --linker-text: #1c1917;
    --linker-button: #1c1917;
    --linker-button-text: #faf7f2;
  }
}

To check it in the preview, switch your own device to light mode.

Buttons that rise in

[data-part="links"] > li {
  animation: rise 500ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

[data-part="links"] > li:nth-child(2) {
  animation-delay: 60ms;
}
[data-part="links"] > li:nth-child(3) {
  animation-delay: 120ms;
}
[data-part="links"] > li:nth-child(4) {
  animation-delay: 180ms;
}
[data-part="links"] > li:nth-child(n + 5) {
  animation-delay: 240ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

No prefers-reduced-motion query needed; Linker handles it.

More room on a wide screen

Use a container query, not @media: in the dashboard, @media reads the window’s size, not the preview’s.

:root {
  container-type: inline-size;
}

@container (min-width: 40rem) {
  [data-part="content"] {
    padding-block: 5rem;
  }

  [data-part="name"] {
    font-size: 1.5rem;
  }
}

Keep your background picture

Draw over your picture by listing it last, in both crops:

:root {
  background-image:
    linear-gradient(transparent 40%, color-mix(in oklab, var(--linker-bg) 85%, transparent)),
    var(--linker-bg-image);
}

@media (max-width: 40rem) {
  :root {
    background-image:
      linear-gradient(transparent 40%, color-mix(in oklab, var(--linker-bg) 85%, transparent)),
      var(--linker-bg-image-mobile);
  }
}

Replacing the picture instead? Also set --linker-bg-dim: 0 on :root.

Only for outline buttons

Only while the button style is Outline. See State attributes.

:root[data-style="outline"] [data-part="link"] {
  border-style: dashed;
}