Custom CSS docs · Page anatomy

Custom CSS

Page anatomy

Every part of a Linker page you can style, what it is, and how to select it.

Select parts by data-part, and the page itself by :root:

[data-part="avatar"] {
  border-radius: 1.5rem;
}

Never select by tag or class: they differ in the preview and change without notice. data-part names don’t.

A Linker page with its parts labelled: avatar, name, description, social, icon, section-title and tile on the left; identity, socials, link, links and grid on the right.

The parts of a page.

The tree

Not every page has every part.

[data-part="page"]                    the root; also :root, html and body in your CSS
├── [data-part="scrim"]               dims a background picture so text stays legible
└── [data-part="content"]             the centred column everything sits in
    ├── [data-part="avatar"]          your picture, or a div with your initials
    ├── [data-part="identity"]
    │   ├── [data-part="name"]
    │   └── [data-part="description"]
    ├── [data-part="links"]           a list of buttons (there can be two, see below)
    │   ├── li [data-part="section"]
    │   │   └── [data-part="section-title"]
    │   └── li
    │       └── [data-part="link"]    a button
    │           ├── [data-part="icon"]
    │           └── the link's name, as text
    ├── [data-part="socials"]         the icon row
    │   └── li
    │       └── [data-part="social"]  an icon-only button
    ├── [data-part="links"]           the buttons below the icon row
    ├── [data-part="grid"]            a grid of tiles
    │   └── [data-part="tiles"]
    │       └── [data-part="tile"]
    │           └── [data-part="link"]
    └── [data-part="carousel"]        a row of cards that scrolls sideways
        └── [data-part="card"]
            └── [data-part="link"]

Blocks come in the order you arranged them, and there can be any number of each.

Every part

Part What it is What Linker gives it
page The root. Holds the background and every variable. In your CSS, :root, html and body mean it too. Background colour and picture, text colour, the font
scrim A layer over a background picture that dims it so text stays legible. Invisible without a picture. --linker-bg at --linker-bg-dim opacity
content The centred column holding everything else. A centred flex column, gap: 0.75rem, padding
avatar Your picture: an img, or a div with your initials when there is no picture. A 4rem circle with a shadow
identity Wraps the name and description. A flex column, gap: 0.25rem
name Your display name, or your handle when there is none. 1rem, semibold
description Your profile description. Line breaks are kept. 0.875rem, 85% opacity, at most 28 characters wide
links A list of buttons. There can be two: one above the icon row and one below it. A flex column up to 20rem wide, gap: 0.5rem
section The list item holding a section title, among the buttons. Centred, with a little space above
section-title A section title’s text. 0.8125rem, semibold
link A button. Every button style and hover effect applies to it. A 2px border, --linker-radius corners, room for the icon
icon The platform icon inside a button, at its left edge. Placed absolutely, vertically centred, 85% opacity
thumb A link’s picture, across the top of its button. Full width, 16:9
caption The label under a link’s picture, holding its icon and name. The padding a plain button has
socials The icon row. Like links, but a wrapping, centred row
social A button in the icon row: an icon, with the link’s name for screen readers. A 2.75rem square
grid A grid of tiles, four cells across. Up to 20rem wide
tiles The grid itself. Four columns of square cells, gap: 0.5rem
tile One tile, holding a link. Spans its cells; its link fills it
carousel A row of cards that scrolls sideways. Snaps to each card
card One card, holding a link: a picture (or the icon) and a caption. 9rem wide (7.5rem portrait, 15rem landscape)

Things that trip people up

Icon-row buttons are social, not link. To style every button:

:is([data-part="link"], [data-part="social"]) {
  border-width: 3px;
}

Tiles and cards hold a link, so button styles reach them too. To style only those: [data-part="tile"] > [data-part="link"].

The avatar may be initials. Style img[data-part="avatar"] and [data-part="avatar"]:not(img).

Hovers need three states: :hover, :focus-visible, and [data-demo] for the dashboard’s preview.

:is([data-part="link"], [data-part="social"]):is(:hover, :focus-visible, [data-demo]) {
  transform: translateY(-2px);
}

Style parts, not positions. li:nth-child(3) breaks when the order changes.

More attributes, like the spotlight, are on State attributes.