← 静的パーツギャラリーへ戻る

パーツ番号 05-13-11 ・ CSSのみ

ミニ棒グラフ内蔵の期間比較KPIカード

大きな数値の下に直近数週間分の推移をミニ棒グラフで添えた構成です。スパークライン(折れ線)とは違う視覚表現として、WordPressの受注件数レポートカードに使えます。

staticcss

プレビュー

ソースコード

HTML

<div class="d05-13-11-card">
          <p class="d05-13-11-label">週次注文件数</p>
          <p class="d05-13-11-value">1,048</p>
          <div class="d05-13-11-bars">
            <span class="d05-13-11-bar" style="height:40%"></span>
            <span class="d05-13-11-bar" style="height:55%"></span>
            <span class="d05-13-11-bar" style="height:48%"></span>
            <span class="d05-13-11-bar" style="height:70%"></span>
            <span class="d05-13-11-bar" style="height:60%"></span>
            <span class="d05-13-11-bar current" style="height:88%"></span>
          </div>
          <p class="d05-13-11-sub">直近6週間の推移</p>
        </div>

CSS

.d05-13-11-card{
          width:100%;max-width:260px;background:#fff;border:1px solid #e5e7eb;
          border-radius:14px;padding:20px 22px;box-sizing:border-box;
        }
        .d05-13-11-label{margin:0 0 8px;font-size:12.5px;font-weight:700;color:#6b7280}
        .d05-13-11-value{margin:0 0 12px;font-size:24px;font-weight:800;color:#1f2937}
        .d05-13-11-bars{display:flex;align-items:flex-end;gap:6px;height:44px;margin-bottom:8px}
        .d05-13-11-bar{flex:1;background:#dbeafe;border-radius:3px 3px 0 0;display:block}
        .d05-13-11-bar.current{background:#2563eb}
        .d05-13-11-sub{margin:0;font-size:11px;color:#9ca3af}

クラス名 .d05-13-11 は本ライブラリ内での識別用です。複数のパーツを同じページで使う場合は、重複しないよう名前を変更してください。