修复服务器卡片指标行在不平台的对齐问题

指标格的标签行与详情行使用 line-height: normal,行盒高度由实际
渲染字体决定:CJK 回退字体(如 Windows 的雅黑)的 normal 行高大于
拉丁文本,同排格子会互相错位,把进度条与详情行顶偏 2-4px。

改为固定行高(标签行 16px、详情行 14px),格子内三段(标签/进度条/
详情)的纵向位置在全平台保持一致。已用 demo 页逐卡测量:8 卡 × 4 格
仅存在一组几何值(headH=16、subH=14、barDelta=20)。
This commit is contained in:
imengying committed 2026-09-13 00:39:54 +08:00
1 parent 2e1d2dd464
commit 761073fffc
1 file changed
+3 -2
+3 -2
View File
@@ -70,10 +70,11 @@
.metric-grid { display: grid; gap: 10px 16px; grid-template-columns: 1fr 1fr; }
.metric { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.metric.muted { opacity: .55; }
.metric > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
/* 固定行高:CJK 回退字体的 normal 行高大于拉丁文本,浮动行高会把进度条与下一行顶偏 */
.metric > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 16px; }
.metric span, .metric small { color: var(--muted-foreground); }
.metric strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.metric small { overflow: hidden; font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.metric small { overflow: hidden; font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; line-height: 14px; }
.progress-track { display: block; width: 100%; height: 4px; overflow: hidden; border-radius: 2px; background: color-mix(in srgb, var(--foreground) 9%, transparent); }
.progress-fill { display: block; height: 100%; border-radius: 2px; transition: width 300ms ease; }
.progress-fill.good { background: var(--success-bar); }