Subgrid Card
A row of cards whose internal sections (title / body / footer) line up across all cards using `grid-template-rows: subgrid`. The titles align even when one is two lines; same for the footer baseline.
The code
<div class="gl-sg">
<article class="gl-sg-card">
<h3 class="gl-sg-title"><span>Compact title</span><span class="gl-sg-pill">subgrid</span></h3>
<p class="gl-sg-body">
Body copy of variable length sits on its own subgrid row so titles always align.
</p>
<footer class="gl-sg-foot"><span>Footer</span><span class="gl-sg-coord">row 3</span></footer>
</article>
<article class="gl-sg-card gl-sg-mid">
<h3 class="gl-sg-title">
<span>A longer two-line card title here</span><span class="gl-sg-pill">subgrid</span>
</h3>
<p class="gl-sg-body">
Subgrid lets this card inherit the parent's row tracks. Bodies stay aligned regardless of
title height.
</p>
<footer class="gl-sg-foot"><span>Footer</span><span class="gl-sg-coord">row 3</span></footer>
</article>
<article class="gl-sg-card">
<h3 class="gl-sg-title"><span>Compact title</span><span class="gl-sg-pill">subgrid</span></h3>
<p class="gl-sg-body">
Without subgrid these would drift. With subgrid each card's three rows lock to the parent.
</p>
<footer class="gl-sg-foot"><span>Footer</span><span class="gl-sg-coord">row 3</span></footer>
</article>
</div> <div class="gl-sg">
<article class="gl-sg-card">
<h3 class="gl-sg-title"><span>Compact title</span><span class="gl-sg-pill">subgrid</span></h3>
<p class="gl-sg-body">
Body copy of variable length sits on its own subgrid row so titles always align.
</p>
<footer class="gl-sg-foot"><span>Footer</span><span class="gl-sg-coord">row 3</span></footer>
</article>
<article class="gl-sg-card gl-sg-mid">
<h3 class="gl-sg-title">
<span>A longer two-line card title here</span><span class="gl-sg-pill">subgrid</span>
</h3>
<p class="gl-sg-body">
Subgrid lets this card inherit the parent's row tracks. Bodies stay aligned regardless of
title height.
</p>
<footer class="gl-sg-foot"><span>Footer</span><span class="gl-sg-coord">row 3</span></footer>
</article>
<article class="gl-sg-card">
<h3 class="gl-sg-title"><span>Compact title</span><span class="gl-sg-pill">subgrid</span></h3>
<p class="gl-sg-body">
Without subgrid these would drift. With subgrid each card's three rows lock to the parent.
</p>
<footer class="gl-sg-foot"><span>Footer</span><span class="gl-sg-coord">row 3</span></footer>
</article>
</div>.gl-sg {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: auto 1fr auto;
gap: 14px;
width: 100%;
min-height: 480px;
padding: 22px;
background:
radial-gradient(60% 80% at 50% 0%, rgba(34,211,238,0.14), transparent 60%),
#061a1f;
font-family: 'Inter', system-ui, sans-serif;
color: #e0f7fa;
box-sizing: border-box;
}
.gl-sg-card {
display: grid;
grid-row: 1 / -1;
grid-template-rows: subgrid;
background: linear-gradient(180deg, rgba(34,211,238,0.12), rgba(8,145,178,0.04));
border: 1px solid rgba(34,211,238,0.28);
border-radius: 14px;
padding: 18px;
gap: 12px;
}
.gl-sg-mid { background: linear-gradient(180deg, #06b6d4, #0891b2); border: 0; color: #061a1f; }
.gl-sg-mid .gl-sg-pill, .gl-sg-mid .gl-sg-coord { background: rgba(6,26,31,0.2); color: #061a1f; }
.gl-sg-mid .gl-sg-body { color: #061a1f; opacity: 0.85; }
.gl-sg-title {
margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3;
display: flex; align-items: flex-start; justify-content: space-between;
gap: 10px;
}
.gl-sg-title span:first-child { color: inherit; }
.gl-sg-pill, .gl-sg-coord {
font-family: 'JetBrains Mono', monospace;
font-size: 10px; letter-spacing: 0.04em;
padding: 2px 8px; border-radius: 999px;
background: rgba(34,211,238,0.16); color: #22d3ee;
flex-shrink: 0;
}
.gl-sg-body { font-size: 13px; line-height: 1.55; margin: 0; color: #b6d8df; }
.gl-sg-foot {
display: flex; align-items: center; justify-content: space-between;
font-size: 12px; padding-top: 10px;
border-top: 1px dashed rgba(34,211,238,0.25);
}
.gl-sg-mid .gl-sg-foot { border-top-color: rgba(6,26,31,0.25); }
@media (max-width: 720px) {
.gl-sg { grid-template-columns: 1fr; grid-template-rows: none; }
.gl-sg-card { grid-row: auto; grid-template-rows: auto auto auto; }
} .gl-sg {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: auto 1fr auto;
gap: 14px;
width: 100%;
min-height: 480px;
padding: 22px;
background:
radial-gradient(60% 80% at 50% 0%, rgba(34,211,238,0.14), transparent 60%),
#061a1f;
font-family: 'Inter', system-ui, sans-serif;
color: #e0f7fa;
box-sizing: border-box;
}
.gl-sg-card {
display: grid;
grid-row: 1 / -1;
grid-template-rows: subgrid;
background: linear-gradient(180deg, rgba(34,211,238,0.12), rgba(8,145,178,0.04));
border: 1px solid rgba(34,211,238,0.28);
border-radius: 14px;
padding: 18px;
gap: 12px;
}
.gl-sg-mid { background: linear-gradient(180deg, #06b6d4, #0891b2); border: 0; color: #061a1f; }
.gl-sg-mid .gl-sg-pill, .gl-sg-mid .gl-sg-coord { background: rgba(6,26,31,0.2); color: #061a1f; }
.gl-sg-mid .gl-sg-body { color: #061a1f; opacity: 0.85; }
.gl-sg-title {
margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3;
display: flex; align-items: flex-start; justify-content: space-between;
gap: 10px;
}
.gl-sg-title span:first-child { color: inherit; }
.gl-sg-pill, .gl-sg-coord {
font-family: 'JetBrains Mono', monospace;
font-size: 10px; letter-spacing: 0.04em;
padding: 2px 8px; border-radius: 999px;
background: rgba(34,211,238,0.16); color: #22d3ee;
flex-shrink: 0;
}
.gl-sg-body { font-size: 13px; line-height: 1.55; margin: 0; color: #b6d8df; }
.gl-sg-foot {
display: flex; align-items: center; justify-content: space-between;
font-size: 12px; padding-top: 10px;
border-top: 1px dashed rgba(34,211,238,0.25);
}
.gl-sg-mid .gl-sg-foot { border-top-color: rgba(6,26,31,0.25); }
@media (max-width: 720px) {
.gl-sg { grid-template-columns: 1fr; grid-template-rows: none; }
.gl-sg-card { grid-row: auto; grid-template-rows: auto auto auto; }
}