탐색

v2.1.0
재질

카드

카드에 주어진 공간에 따라 내부 배치가 달라지는, 살짝 떠 있는 시트입니다.

이 페이지의 내용

카드는 미디어, 헤더, 본문, 작업을 담는 푸터로 구성된, 살짝 떠 있는 시트입니다. .card를 <article>, <section> 또는 목록 항목에 적용합니다. 카드는 크기 컨테이너이므로 각 부분은 뷰포트 대신 카드에 주어진 공간에 맞춰 배치됩니다. 사이드바, 그리드, 전체 너비 열에서 동일한 마크업을 사용할 수 있습니다.

카드

<article class="card max-w(320) mx-auto">  <img class="card-media" src="/demo/moonstone.svg" alt>  <header class="card-header">    <h3 class="card-title">Atlas</h3>    <p class="card-description">atlas.dev · Deployed 2 hours ago</p>    <span class="badge badge-success badge-dot card-action">Ready</span>  </header>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Logs</button>    <button type="button" class="btn btn-sm btn-primary">Visit</button>  </footer></article>
<article className="card max-w(320) mx-auto">  <img className="card-media" src="/demo/moonstone.svg" alt="" />  <header className="card-header">    <h3 className="card-title">Atlas</h3>    <p className="card-description">atlas.dev · Deployed 2 hours ago</p>    <span className="badge badge-success badge-dot card-action">Ready</span>  </header>  <footer className="card-footer">    <button type="button" className="btn btn-sm">Logs</button>    <button type="button" className="btn btn-sm btn-primary">Visit</button>  </footer></article>
<article class="card max-w(320) mx-auto">  <img class="card-media" src="/demo/moonstone.svg" alt>  <header class="card-header">    <h3 class="card-title">Atlas</h3>    <p class="card-description">atlas.dev · Deployed 2 hours ago</p>    <span class="badge badge-success badge-dot card-action">Ready</span>  </header>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Logs</button>    <button type="button" class="btn btn-sm btn-primary">Visit</button>  </footer></article>
<template>  <article class="card max-w(320) mx-auto">    <img class="card-media" src="/demo/moonstone.svg" alt>    <header class="card-header">      <h3 class="card-title">Atlas</h3>      <p class="card-description">atlas.dev · Deployed 2 hours ago</p>      <span class="badge badge-success badge-dot card-action">Ready</span>    </header>    <footer class="card-footer">      <button type="button" class="btn btn-sm">Logs</button>      <button type="button" class="btn btn-sm btn-primary">Visit</button>    </footer>  </article></template>

#구성 요소

각 부분은 선택 사항이며, 카드에 포함된 부분 사이에는 1rem 간격이 생깁니다.

  • card-media는 카드 상단에 배치되는 이미지나 동영상입니다. 카드 가장자리에서 4px 안쪽에 배치되고, 모서리 반경은 카드보다 4px 작아 둥근 모서리의 중심이 일치합니다. 안쪽에 옅은 윤곽선이 있어 밝은 이미지도 경계가 드러납니다.
  • card-header에는 card-title, card-description, 그리고 끝부분에 놓이는 card-action이 들어갑니다. 끝부분에는 상태 표시, 메뉴 버튼 또는 스위치를 배치할 수 있습니다.
  • card-body에는 원하는 콘텐츠를 넣을 수 있습니다.
  • card-footer는 작업 항목을 끝에 맞춰 정렬하고 주요 작업을 맨 마지막에 배치합니다.

카드 구성 요소

<section class="card max-w(380) mx-auto">  <header class="card-header">    <h3 class="card-title">Preview deployments</h3>    <p class="card-description">Every pull request gets its own URL.</p>    <input type="checkbox" role="switch" class="switch card-action" checked aria-label="Preview deployments">  </header>  <div class="card-body">    <label class="field">Branch pattern <input class="input" value="feature/*"></label>  </div>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Reset</button>    <button type="button" class="btn btn-sm btn-primary">Save</button>  </footer></section>
<section className="card max-w(380) mx-auto">  <header className="card-header">    <h3 className="card-title">Preview deployments</h3>    <p className="card-description">Every pull request gets its own URL.</p>    <input type="checkbox" role="switch" className="switch card-action" defaultChecked aria-label="Preview deployments" />  </header>  <div className="card-body">    <label className="field">      Branch pattern <input className="input" defaultValue="feature/*" />    </label>  </div>  <footer className="card-footer">    <button type="button" className="btn btn-sm">Reset</button>    <button type="button" className="btn btn-sm btn-primary">Save</button>  </footer></section>
<section class="card max-w(380) mx-auto">  <header class="card-header">    <h3 class="card-title">Preview deployments</h3>    <p class="card-description">Every pull request gets its own URL.</p>    <input type="checkbox" role="switch" class="switch card-action" checked aria-label="Preview deployments">  </header>  <div class="card-body">    <label class="field">Branch pattern <input class="input" value="feature/*"></label>  </div>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Reset</button>    <button type="button" class="btn btn-sm btn-primary">Save</button>  </footer></section>
<template>  <section class="card max-w(380) mx-auto">    <header class="card-header">      <h3 class="card-title">Preview deployments</h3>      <p class="card-description">Every pull request gets its own URL.</p>      <input type="checkbox" role="switch" class="switch card-action" checked aria-label="Preview deployments">    </header>    <div class="card-body">      <label class="field">Branch pattern <input class="input" value="feature/*"></label>    </div>    <footer class="card-footer">      <button type="button" class="btn btn-sm">Reset</button>      <button type="button" class="btn btn-sm btn-primary">Save</button>    </footer>  </section></template>

#컨테이너 너비에 따른 배치

카드는 container: card / inline-size를 선언하고 각 부분은 컨테이너 쿼리로 카드 크기를 확인합니다. 쿼리는 패딩 안쪽에 있는 카드의 콘텐츠 상자를 기준으로 크기를 측정합니다.

  • 너비가 15rem 미만이면 card-action이 제목과 설명 아래로 이동합니다. 푸터 버튼은 각각 전체 너비를 차지하도록 세로로 배치되며, 주요 작업 버튼이 맨 위에 놓입니다.
  • card-split은 너비가 28rem 이상이면 미디어를 콘텐츠 옆에 두고 카드의 세 가장자리에서 4px씩 안쪽으로 배치합니다. 28rem 미만이면 미디어를 콘텐츠 위에 배치합니다.

손잡이를 드래그하면 미리보기의 너비를 줄일 수 있습니다. 레이아웃은 창 너비와 관계없이 카드 너비에 따라 바뀝니다.

분할 카드

656 px
<article class="card card-split">  <img class="card-media" src="/demo/moonstone.svg" alt>  <header class="card-header">    <h3 class="card-title">Moonstone and obsidian</h3>    <p class="card-description">One material language in light and dark.</p>    <span class="badge card-action">Guide</span>  </header>  <div class="card-body">    Every surface is a step on one ladder, lit from above. Edges are half-pixel contours and short shadows that fade.  </div>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Later</button>    <button type="button" class="btn btn-sm btn-primary">Read the guide</button>  </footer></article>
<article className="card card-split">  <img className="card-media" src="/demo/moonstone.svg" alt="" />  <header className="card-header">    <h3 className="card-title">Moonstone and obsidian</h3>    <p className="card-description">One material language in light and dark.</p>    <span className="badge card-action">Guide</span>  </header>  <div className="card-body">    Every surface is a step on one ladder, lit from above. Edges are half-pixel contours and short shadows that fade.  </div>  <footer className="card-footer">    <button type="button" className="btn btn-sm">Later</button>    <button type="button" className="btn btn-sm btn-primary">Read the guide</button>  </footer></article>
<article class="card card-split">  <img class="card-media" src="/demo/moonstone.svg" alt>  <header class="card-header">    <h3 class="card-title">Moonstone and obsidian</h3>    <p class="card-description">One material language in light and dark.</p>    <span class="badge card-action">Guide</span>  </header>  <div class="card-body">    Every surface is a step on one ladder, lit from above. Edges are half-pixel contours and short shadows that fade.  </div>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Later</button>    <button type="button" class="btn btn-sm btn-primary">Read the guide</button>  </footer></article>
<template>  <article class="card card-split">    <img class="card-media" src="/demo/moonstone.svg" alt>    <header class="card-header">      <h3 class="card-title">Moonstone and obsidian</h3>      <p class="card-description">One material language in light and dark.</p>      <span class="badge card-action">Guide</span>    </header>    <div class="card-body">      Every surface is a step on one ladder, lit from above. Edges are half-pixel contours and short shadows that fade.    </div>    <footer class="card-footer">      <button type="button" class="btn btn-sm">Later</button>      <button type="button" class="btn btn-sm btn-primary">Read the guide</button>    </footer>  </article></template>

카드는 크기 컨테이너이므로 그리드 트랙, 기준 크기가 지정된 플렉스 항목, 블록 등 카드가 놓인 레이아웃에서 너비가 정해져야 합니다. inline-flex처럼 콘텐츠에 맞춰 너비가 줄어드는 경우에는 카드 너비를 지정합니다.

#평면 카드

card-flat은 윤곽선 하나만 유지하고 높이 효과를 없앱니다. 촘촘한 목록이나 트레이에 놓이는 카드에 사용합니다.

평면 카드

<div class="tray grid grid-cols(2) gap(4)">  <article class="card card-flat">    <header class="card-header">      <h3 class="card-title">Requests</h3>      <p class="card-description">Last 24 hours</p>    </header>    <div class="card-body text-md fg-text-strong">1.28M</div>  </article>  <article class="card card-flat">    <header class="card-header">      <h3 class="card-title">Errors</h3>      <p class="card-description">Last 24 hours</p>    </header>    <div class="card-body text-md fg-text-strong">0.02%</div>  </article></div>
<div className="tray grid grid-cols(2) gap(4)">  <article className="card card-flat">    <header className="card-header">      <h3 className="card-title">Requests</h3>      <p className="card-description">Last 24 hours</p>    </header>    <div className="card-body text-md fg-text-strong">1.28M</div>  </article>  <article className="card card-flat">    <header className="card-header">      <h3 className="card-title">Errors</h3>      <p className="card-description">Last 24 hours</p>    </header>    <div className="card-body text-md fg-text-strong">0.02%</div>  </article></div>
<div class="tray grid grid-cols(2) gap(4)">  <article class="card card-flat">    <header class="card-header">      <h3 class="card-title">Requests</h3>      <p class="card-description">Last 24 hours</p>    </header>    <div class="card-body text-md fg-text-strong">1.28M</div>  </article>  <article class="card card-flat">    <header class="card-header">      <h3 class="card-title">Errors</h3>      <p class="card-description">Last 24 hours</p>    </header>    <div class="card-body text-md fg-text-strong">0.02%</div>  </article></div>
<template>  <div class="tray grid grid-cols(2) gap(4)">    <article class="card card-flat">      <header class="card-header">        <h3 class="card-title">Requests</h3>        <p class="card-description">Last 24 hours</p>      </header>      <div class="card-body text-md fg-text-strong">1.28M</div>    </article>    <article class="card card-flat">      <header class="card-header">        <h3 class="card-title">Errors</h3>        <p class="card-description">Last 24 hours</p>      </header>      <div class="card-body text-md fg-text-strong">0.02%</div>    </article>  </div></template>

#상호작용 카드

카드 전체가 하나의 링크나 버튼이면 <a> 또는 <button> 자체에 card와 card-interactive를 적용합니다. 버튼처럼 포인터를 올리면 살짝 떠오르고 누르면 내려앉습니다. 카드 안에 다른 컨트롤을 중첩하지 않습니다.

상호작용 카드

<a class="card card-interactive" href="#installation">  <span class="card-header">    <span class="card-title">Installation</span>    <span class="card-description">Add Master UI to a project.</span>  </span></a><a class="card card-interactive" href="#theme">  <span class="card-header">    <span class="card-title">Theme</span>    <span class="card-description">Materials, light and tokens.</span>  </span></a>
<>  <a className="card card-interactive" href="#installation">    <span className="card-header">      <span className="card-title">Installation</span>      <span className="card-description">Add Master UI to a project.</span>    </span>  </a>  <a className="card card-interactive" href="#theme">    <span className="card-header">      <span className="card-title">Theme</span>      <span className="card-description">Materials, light and tokens.</span>    </span>  </a></>
<a class="card card-interactive" href="#installation">  <span class="card-header">    <span class="card-title">Installation</span>    <span class="card-description">Add Master UI to a project.</span>  </span></a><a class="card card-interactive" href="#theme">  <span class="card-header">    <span class="card-title">Theme</span>    <span class="card-description">Materials, light and tokens.</span>  </span></a>
<template>  <a class="card card-interactive" href="#installation">    <span class="card-header">      <span class="card-title">Installation</span>      <span class="card-description">Add Master UI to a project.</span>    </span>  </a>  <a class="card card-interactive" href="#theme">    <span class="card-header">      <span class="card-title">Theme</span>      <span class="card-description">Materials, light and tokens.</span>    </span>  </a></template>

카드가 하나의 목적지이면서 상태, 메뉴, 자체 버튼도 담고 있다면 카드는 <article>로 두고 제목 안의 <a>에 card-link를 적용합니다. 링크의 대상 영역이 카드 전체로 늘어나므로 미디어, 여백, 제목 어디를 눌러도 링크로 이동합니다. 설명, 본문, 동작, 푸터는 그 위에 놓이므로 텍스트를 선택하고 복사할 수 있고, 각 컨트롤도 자기 대상 영역을 그대로 유지합니다. 포인터가 링크 위에 있는 동안 카드가 떠오르고, 링크에 포커스가 가면 카드 전체에 포커스 링이 그려집니다. card-link는 카드마다 하나만 사용합니다. 링크의 이름은 제목이므로 제목을 짧게 유지합니다.

카드 안에 링크가 있는 카드가 들어 있으면 안쪽 제목의 포커스와 호버는 안쪽 카드에만 적용됩니다. :has()를 지원하지 않는 브라우저에서는 카드의 떠오름 효과가 생략되며, 각 링크의 조작 영역과 포커스 링은 유지됩니다.

주요 링크

<article class="card max-w(320) mx-auto">  <header class="card-header">    <h3 class="card-title"><a class="card-link" href="#main-link">Atlas</a></h3>    <p class="card-description">atlas.dev · Deployed 2 hours ago</p>    <span class="badge badge-success badge-dot card-action">Ready</span>  </header>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Logs</button>    <a class="btn btn-sm" href="#main-link">Settings</a>  </footer></article>
<article className="card max-w(320) mx-auto">  <header className="card-header">    <h3 className="card-title"><a className="card-link" href="#main-link">Atlas</a></h3>    <p className="card-description">atlas.dev · Deployed 2 hours ago</p>    <span className="badge badge-success badge-dot card-action">Ready</span>  </header>  <footer className="card-footer">    <button type="button" className="btn btn-sm">Logs</button>    <a className="btn btn-sm" href="#main-link">Settings</a>  </footer></article>
<article class="card max-w(320) mx-auto">  <header class="card-header">    <h3 class="card-title"><a class="card-link" href="#main-link">Atlas</a></h3>    <p class="card-description">atlas.dev · Deployed 2 hours ago</p>    <span class="badge badge-success badge-dot card-action">Ready</span>  </header>  <footer class="card-footer">    <button type="button" class="btn btn-sm">Logs</button>    <a class="btn btn-sm" href="#main-link">Settings</a>  </footer></article>
<template>  <article class="card max-w(320) mx-auto">    <header class="card-header">      <h3 class="card-title"><a class="card-link" href="#main-link">Atlas</a></h3>      <p class="card-description">atlas.dev · Deployed 2 hours ago</p>      <span class="badge badge-success badge-dot card-action">Ready</span>    </header>    <footer class="card-footer">      <button type="button" class="btn btn-sm">Logs</button>      <a class="btn btn-sm" href="#main-link">Settings</a>    </footer>  </article></template>

#클래스

클래스설명
card크기 컨테이너 역할을 하는 볼록한 표면입니다. 내부 요소 사이의 간격은 1rem입니다.
card-flat촘촘한 목록이나 트레이 위에 놓인 카드에 윤곽선 하나만 적용하고 그림자는 생략합니다.적용할 클래스는 card입니다
card-interactive카드 전체가 하나의 링크 또는 버튼으로 동작합니다. 포인터를 올리면 떠오르고 누르면 내려갑니다. 카드 안에 다른 컨트롤을 넣지 마세요.적용할 클래스는 card입니다
card-split콘텐츠 너비가 28rem 이상이면 미디어를 콘텐츠 옆에, 그보다 좁으면 위에 배치합니다.적용할 클래스는 card입니다
card-link다른 컨트롤도 들어 있는 카드에서 제목 안의 <a>에 적용하는 주요 링크입니다. 조작 영역이 카드 전체를 덮지만 설명, 본문, 액션, 푸터는 각자의 포인터 동작과 텍스트 선택을 유지합니다. 포인터가 올라가 있는 동안 카드가 떠오르고, 포커스를 받으면 포커스 링이 카드 전체를 두릅니다.
card-media카드 상단 가장자리에서 4px 안쪽에 배치한 이미지 또는 동영상. 기본 가로세로 비율은 16 / 9입니다.
card-header제목과 설명을 묶는 그룹입니다. 필요한 경우 끝에 동작을 배치합니다.
card-title헤더에 표시하는 제목
card-description헤더의 제목 아래에 낮은 강조도로 표시하는 한 줄 문구입니다.
card-action헤더 끝에 배치하는 컨트롤 또는 상태 표시로, 제목의 첫 줄 옆에 놓입니다. 배지는 설명이 전체 너비를 쓰도록 두고, 버튼이나 스위치는 제목과 설명 옆에 자체 열을 유지합니다. 콘텐츠 너비가 15rem 미만이면 텍스트 아래로 이동합니다.
card-body자유 형식 콘텐츠
card-footer하단 동작은 끝에 정렬하고 주 동작을 마지막에 배치합니다. 콘텐츠 너비가 15rem 미만이면 각 동작이 전체 너비를 차지하도록 세로로 배치하고 주 동작을 맨 위에 둡니다.

#사용자 지정 속성

속성기본값설명
--card-padding1.25rem구성 요소 둘레의 패딩
--card-radiusvar(--radius-surface)모서리 반경
--card-media-inset4px미디어와 카드 가장자리 사이 간격
--card-split.4분할 카드에서 미디어가 차지하는 너비 비율card-split에 설정합니다

#소스

@master/ui/components/card.css
/* * Card: a raised sheet with a small structure: media, a header, a body and a footer of actions. * The card is a size container, so its parts follow the room the card is given, not the viewport: the header's * action drops under the title and the footer's buttons stack in a narrow card, and a split card sets its * media beside its content once it is wide enough. Queries measure the card's content box, inside its padding. * Media sits 4px inside, and its corner is the card's corner minus that inset. * A card that is one destination and also holds other controls marks its title's link card-link: the link's * target is stretched over the card, under the description, the body, the action and the footer, so the words * stay selectable and every other control stays its own target. * In a browser without :has(), the links keep their targets and focus rings while the cards stay at rest. */@layer components.ui {  .card {    --card-padding: 1.25rem;    --card-radius: var(--radius-surface);    --card-media-inset: 4px;    --surface-color: var(--color-surface-raised);    container: card / inline-size;    position: relative;    display: flex;    flex-direction: column;    gap: 1rem;    min-width: 0;    padding: var(--card-padding);    border-radius: calc(var(--card-radius) * var(--corner-scale));    corner-shape: var(--corner-shape);    @apply --surface-sheet;    color: var(--color-text-body);    box-shadow: var(--shadow-lifted);    font-size: .875rem;    line-height: 1.55;    text-decoration: none;    /* One contour and no lift, for cards in a dense list or on a tray. */    &.card-flat {      background: var(--color-surface-raised);      box-shadow: var(--shadow-flat);    }    /* A card that is one link or button: it lifts under the pointer and sinks when pressed, as a button does. */    &.card-interactive {      --card-lift: calc(-2 * var(--lift));      /* On a <button>, the browser's own border, face and type give way to the card's. */      margin: 0;      border: 0;      font-family: inherit;      text-align: inherit;      appearance: none;      -webkit-tap-highlight-color: transparent;      touch-action: manipulation;      cursor: pointer;      transition-property: box-shadow, translate;      transition-duration: var(--duration-quick);      transition-timing-function: var(--easing-glide);      @media (hover: hover) {        &:hover:not(:disabled, [aria-disabled="true"]) {          translate: 0 var(--card-lift);          box-shadow: var(--shadow-floating);        }      }      &:active:not(:disabled, [aria-disabled="true"]) {        translate: 0 0;        box-shadow: var(--shadow-raised);        transition-duration: var(--duration-press);      }      &:focus-visible {        @apply --focus-ring;      }      /* A card that cannot be followed now lies flat in a well, in disabled ink, as a disabled button does. */      &:is(:disabled, [aria-disabled="true"]) {        background: var(--color-surface-inset);        color: var(--color-text-disabled);        box-shadow: var(--shadow-flat);        cursor: not-allowed;        .card-title, .card-description {          color: inherit;        }      }      @media (prefers-reduced-motion: reduce) {        --card-lift: 0px;      }    }    /*     * A card whose title is its main link: it lifts while the pointer is over the link's stretched target, not over     * a control or the words above it, and the link's focus rings the whole card.     */    &:has(.card-link) {      --card-lift: calc(-2 * var(--lift));      transition-property: box-shadow, translate;      transition-duration: var(--duration-quick);      transition-timing-function: var(--easing-glide);      /* What stands over the link's target keeps the pointer: words to select, and controls of its own. */      .card-description, .card-action, .card-body, .card-footer {        position: relative;        z-index: 1;      }      @media (prefers-reduced-motion: reduce) {        --card-lift: 0px;      }    }    /* A pointer on a nested card's link changes that card's depth only. */    @media (hover: hover) {      &:has(.card-link:hover):not(:has(.card .card-link:hover)) {        translate: 0 var(--card-lift);        box-shadow: var(--shadow-floating);      }    }    &:has(.card-link:active):not(:has(.card .card-link:active)) {      translate: 0 0;      box-shadow: var(--shadow-raised);      transition-duration: var(--duration-press);    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }  /*   * The main link, on the <a> in the title. Its target is a box stretched over the whole card, so a press on the   * media, the padding or the title follows it. Its ring belongs to that box and stays on the nearest card.   */  .card-link {    color: inherit;    text-decoration: none;    -webkit-tap-highlight-color: transparent;    &::after {      content: '';      position: absolute;      inset: 0;      border-radius: calc(var(--card-radius) * var(--corner-scale));      corner-shape: var(--corner-shape);    }    &:focus-visible {      outline: none;      &::after {        @apply --focus-ring;        @media (forced-colors: active) {          outline-color: Highlight;        }      }    }  }  /* An image or video at the top of the card, finished with a faint inward outline so pale pixels keep an edge. */  .card-media {    display: block;    flex: none;    width: calc(100% + (var(--card-padding) - var(--card-media-inset)) * 2);    max-width: none;    margin: calc(var(--card-media-inset) - var(--card-padding));    margin-block-end: 0;    border-radius: calc(var(--card-radius) * var(--corner-scale) - var(--card-media-inset));    corner-shape: var(--corner-shape);    aspect-ratio: 16 / 9;    object-fit: cover;    background: var(--color-surface-chip);    outline: 1px solid var(--color-line-image);    outline-offset: -1px;  }  /* The title and its description, with an optional action at the end of the first line. */  .card-header {    display: grid;    grid-template-columns: minmax(0, 1fr) auto;    gap: .25rem 1rem;    align-items: start;  }  .card-title {    grid-column: 1;    margin: 0;    color: var(--color-text-strong);    font: var(--font-weight-control) .9375rem/1.4 var(--font-family-sans);    font-feature-settings: inherit;    text-wrap: balance;    overflow-wrap: anywhere;  }  /* The description runs under the title and under an action that stands beside the title, to the header's end. */  .card-description {    grid-column: 1 / -1;    margin: 0;    color: var(--color-text-muted);    font-size: .8125rem;    text-wrap: pretty;    overflow-wrap: anywhere;  }  /*   * A control or a status at the end of the header. It belongs to the title, so it stands beside the title's line   * and takes its width from that line alone: a badge a line tall leaves the description the whole header.   * Under 15rem of content it moves below the text it belongs to.   */  .card-action {    grid-row: 1;    grid-column: 2;    align-self: start;    @container card (inline-size < 15rem) {      grid-row: auto;      grid-column: 1;      justify-self: start;      margin-block-start: .375rem;    }  }  /*   * A button there centers on the title's first line, as one in an alert does: it reaches as far above and below   * that line as it is taller than it, so it stands beside the title, not hanging below it, and does not deepen   * the header. The line is the title's, .9375rem at 1.4. Under the text, it is a row of its own again.   */  .card-action.btn, .card-action .btn {    margin-block: calc((.9375rem * 1.4 - var(--btn-height)) / 2);    @container card (inline-size < 15rem) {      margin-block: 0;    }  }  .card-action.btn {    @container card (inline-size < 15rem) {      margin-block-start: .375rem;    }  }  /*   * A button or a switch is taller than the title's line and reaches under it, so a header that holds one keeps   * the description out of its column: the two would meet at the end of the description's first line.   */  .card-header:has(.card-action.btn, .card-action .btn, .card-action.switch) {    .card-description {      grid-column: 1;    }    .card-action {      grid-row: 1 / span 2;      @container card (inline-size < 15rem) {        grid-row: auto;      }    }  }  .card-body {    min-width: 0;  }  /* Actions at the foot of the card. Under 15rem of content they stack at full width, the last one first. */  .card-footer {    display: flex;    flex-wrap: wrap;    align-items: center;    justify-content: flex-end;    gap: .5rem;    margin-block-start: auto;    @container card (inline-size < 15rem) {      flex-direction: column-reverse;      align-items: stretch;    }  }  /*   * Split: from 28rem of content the media stands beside it, 4px inside the card on three sides.   * A container cannot restyle itself from its own query, so the media is placed against the card's edge and   * the other parts make room for it.   */  .card-split {    --card-split: .4;    @container card (inline-size >= 28rem) {      .card-media {        position: absolute;        inset-block: var(--card-media-inset);        inset-inline-start: var(--card-media-inset);        width: calc(100% * var(--card-split) - var(--card-media-inset));        height: calc(100% - var(--card-media-inset) * 2);        margin: 0;        aspect-ratio: auto;      }      .card-header, .card-body, .card-footer {        /* The media ends at --card-split of the card's width; a percentage here is of the content box. */        margin-inline-start: calc((100% + var(--card-padding) * 2) * var(--card-split));      }    }  }}