Skip to content
Español

Navigate

Type to search. Press Escape to close.

    Components · css

    Card

    A surface that groups related content. Use <article> when the card is self-contained content, a <div> otherwise. No JavaScript.

    CSS: included in ivolt.css; standalone css/components/card.css.

    A card with body and footerfixtures/card/basic.htmlOpen alone — A card with body and footer
    <article class="iv-card" style="max-width: 24rem">
      <div class="iv-card__body">
        <h3 class="iv-card__title">Editorial catalogue</h3>
        <p class="iv-u-text-muted iv-u-m-0">Cards, filters and a detail page built from the same primitives.</p>
      </div>
      <div class="iv-card__footer">
        <a class="iv-button iv-button--ghost iv-button--sm" href="#recipes">Preview</a>
        <a class="iv-button iv-button--primary iv-button--sm" href="#recipes">Open recipe</a>
      </div>
    </article>

    Media, flat and footer actions

    Media, flat and footer actionsfixtures/card/media.htmlOpen alone — Media, flat and footer actions
    <div class="iv-grid iv-u-gap-4 iv-u-grid-cols-1 iv-u-md-grid-cols-3">
      <article class="iv-card">
        <div class="iv-card__media" aria-hidden="true"></div>
        <div class="iv-card__body">
          <h3 class="iv-card__title">Quarterly review</h3>
          <p class="iv-u-m-0">Placeholder media (16:9). Real images use an <code>&lt;img&gt;</code> inside the media block.</p>
        </div>
      </article>
      <article class="iv-card iv-card--flat">
        <div class="iv-card__body">
          <h3 class="iv-card__title">Flat card</h3>
          <p class="iv-u-m-0">No shadow, border only. Suits dense layouts and dark surfaces.</p>
        </div>
      </article>
      <article class="iv-card">
        <div class="iv-card__body">
          <h3 class="iv-card__title">Footer actions</h3>
          <p class="iv-u-m-0">Actions align to the end of the footer.</p>
        </div>
        <div class="iv-card__footer">
          <button class="iv-button iv-button--primary iv-button--sm" type="button">Action</button>
        </div>
      </article>
    </div>

    With photographs

    Real images, proximity-lit edges and a lift on hover.

    Cards with photographsfixtures/card/photo.htmlOpen alone — Cards with photographs
    <div class="iv-grid iv-grid--auto" style="--iv-grid-min: 16rem">
      <article class="iv-card iv-edge-near iv-elevate">
        <figure class="iv-card__media"><img src="/photos/p1059.jpg" width="1280" height="800" alt="A workshop table with tools and a leather apron" loading="lazy"></figure>
        <div class="iv-card__body"><h3 class="iv-card__title">Workshop notes</h3><p>Photograph by Clark Street Mercantile on Unsplash. Sample copy: cards with real media, proximity-lit edges and a lift on hover.</p></div>
        <footer class="iv-card__footer"><a class="iv-button iv-button--secondary iv-button--sm" href="#card-photo-note">Read more</a></footer>
      </article>
      <article class="iv-card iv-edge-near iv-elevate">
        <figure class="iv-card__media"><img src="/photos/p1074.jpg" width="1280" height="800" alt="A lion resting in dry grass" loading="lazy"></figure>
        <div class="iv-card__body"><h3 class="iv-card__title">Field guide</h3><p>Photograph by Samuel Scrimshaw on Unsplash. Media keeps its aspect ratio and the card never exceeds its column.</p></div>
        <footer class="iv-card__footer"><a class="iv-button iv-button--secondary iv-button--sm" href="#card-photo-note">Read more</a></footer>
      </article>
      <article class="iv-card iv-edge-near iv-elevate">
        <figure class="iv-card__media"><img src="/photos/p1084.jpg" width="1280" height="800" alt="Icebergs and dark water under a low sky" loading="lazy"></figure>
        <div class="iv-card__body"><h3 class="iv-card__title">Cold coast</h3><p>Photograph by Jay Ruzesky on Unsplash. Alt text describes the picture; decorative images would use an empty alt.</p></div>
        <footer class="iv-card__footer"><a class="iv-button iv-button--secondary iv-button--sm" href="#card-photo-note">Read more</a></footer>
      </article>
    </div>
    <p id="card-photo-note" class="iv-u-text-sm iv-u-text-muted iv-u-m-0" style="margin-block-start: var(--iv-space-3)">The links only jump to this note.</p>
    .iv-root {
      --iv-grid-min: 16rem;
    }

    Anatomy

    ClassRole
    iv-cardSurface with border, radius and shadow; flex column.
    iv-card__media16:9 area; an <img> inside is cropped with object-fit: cover.
    iv-card__bodyPadded content that grows to fill the card.
    iv-card__titleHeading inside the body (pick the right level for the page).
    iv-card__footerActions aligned to the end.
    iv-card--flatNo shadow.

    Elevation

    A card rests on --iv-shadow-ambient, the shared resting elevation added in v0.6: one token that already carries the edge ring a dark theme needs and the soft drop a light one does. Under a pointer it steps up to --iv-shadow-2; the lift is inside @media (hover: hover), so a touch screen never gets a stuck hover state, and it is a shadow change only, with no travel to jog the layout.

    Two public locals retune it in one line: --iv-card-shadow for the resting elevation and --iv-card-shadow-hover for the one under the pointer. Set either to none to cancel it — that is exactly what iv-card--flat does. Together with --iv-card-bg, --iv-card-radius and --iv-card-padding, that is the whole surface of the component.

    Responsive and link cards

    New in 1.1 Two progressive modifiers built on modern CSS, with no media query and no script.

    Responsive card and a subgrid row of link cardsfixtures/card/modern.htmlOpen alone — Responsive card and a subgrid row of link cards
    <div class="iv-stack iv-u-gap-6">
      <article class="iv-card iv-card--responsive">
        <div class="iv-card__media" aria-hidden="true"></div>
        <div class="iv-card__body iv-stack iv-u-gap-2">
          <h3 class="iv-card__title">Responsive card</h3>
          <p class="iv-u-m-0 iv-u-text-muted">The media sits beside the text while the card is wide and moves above it when the card gets narrow. The decision follows the room the card has, not the size of the window.</p>
        </div>
        <footer class="iv-card__footer"><a class="iv-button iv-button--ghost iv-button--sm" href="#card-modern-note">Details</a></footer>
      </article>
    
      <div class="iv-grid iv-grid--subgrid iv-u-gap-4 iv-u-grid-cols-1 iv-u-md-grid-cols-3">
        <article class="iv-card iv-card--link iv-u-p-5">
          <h3 class="iv-card__title iv-u-m-0"><a class="iv-card__link" href="#card-modern-note">Link card</a></h3>
          <p class="iv-u-m-0 iv-u-text-muted">The whole card is the target of the link in its title.</p>
          <span class="iv-card__raise"><span class="iv-badge iv-badge--primary">Guide</span></span>
        </article>
        <article class="iv-card iv-card--link iv-u-p-5">
          <h3 class="iv-card__title iv-u-m-0"><a class="iv-card__link" href="#card-modern-note">A title long enough to wrap onto a second line</a></h3>
          <p class="iv-u-m-0 iv-u-text-muted">Focus with the keyboard and the ring goes round the card; the rows of the three cards stay aligned.</p>
          <span class="iv-card__raise"><span class="iv-badge">Reference</span></span>
        </article>
        <article class="iv-card iv-card--link iv-u-p-5">
          <h3 class="iv-card__title iv-u-m-0"><a class="iv-card__link" href="#card-modern-note">Third card</a></h3>
          <p class="iv-u-m-0 iv-u-text-muted">Short text.</p>
          <span class="iv-card__raise"><span class="iv-badge">Tutorial</span></span>
        </article>
      </div>
    
      <p class="iv-u-m-0 iv-u-text-sm iv-u-text-muted" id="card-modern-note">Every link leads back to this note. The row of link cards uses <code>iv-grid--subgrid</code>: titles, texts and badges line up across the cards.</p>
    </div>

    iv-card--responsive puts the media beside the body while the card has room and moves it above the body when it does not. The decision follows the card's own width — the media keeps --iv-card-media-width (16rem) and the body wraps under it once it would fall below 55 % of the card — so the same card is horizontal in a wide column and vertical in a sidebar on the same page.

    iv-card--link makes the whole card one target. The link stays in the title (iv-card__link) and stretches over the card with a pseudo-element, so its accessible name is the title and not the whole card read aloud. The focus ring goes round the card when the link has focus, and anything that must stay clickable on its own — a badge that is a link, a menu button — goes in iv-card__raise, which sits above the stretched link. On a pointer the card lifts by two pixels and its border takes the brand edge; under reduced motion it does not move.

    The row above also uses iv-grid--subgrid, documented on layout: titles, texts and badges line up across the three cards whatever the length of each title.

    Common mistakes

    • Making the whole card a link with nested interactive controls. Link the title instead.
    • Skipping heading levels inside cards.