CSS Tutorial

CSS Project: Dashboard Cards

A small stats dashboard: four metric cards on a grid, with a muted header and numeric emphasis.

What you will build

A morning board for Harbor studio. A muted header names the day. Four metric cards sit on a grid: tables booked, loaves out, prints on the line, and espresso pulled. The numbers are the loudest type. Labels stay small and quiet.

CSS variables hold the sky palette so every card shares ink, paper, and accent. Change one custom property and the board shifts together.

Open an example with Try it in CSS. That loads /css/try — a live page preview.

Properties you will use

PropertyJob on this page
display: gridLays four metric cards in a responsive row
CSS variables (--ink, --accent)Keeps the harbor palette in one place
font-size / font-weightMakes the number dominate the card
letter-spacingQuiets the header and the metric labels
gapEven space between cards

The numbers are text in p or data, not images. If you need to change 12 to 13, you edit a digit, not a graphic.

Build in slices

First the palette and one metric card. The label is small. The figure is large. Variables live on:root.

Example

<style>
  :root {
    --ink: #0c4a6e;
    --paper: #e0f2fe;
    --card: #fff;
    --accent: #0284c7;
    --muted: #075985;
  }
  body {
    font-family: system-ui, sans-serif;
    background: var(--paper);
    color: var(--ink);
    margin: 1.5rem;
  }
  .metric {
    background: var(--card);
    border-radius: 1rem;
    padding: 1.1rem 1.15rem 1.2rem;
    box-shadow: 0 10px 22px rgba(12, 74, 110, 0.1);
  }
  .label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .figure {
    margin: 0.25rem 0 0;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.1;
  }
</style>
<article class="metric">
  <p class="label">Tables booked</p>
  <p class="figure">12</p>
</article>

Then place four cards on a grid with a muted page header. auto-fit drops to two columns, then one, as the window narrows.

Example

<style>
  .board-head {
    margin-bottom: 1.1rem;
  }
  .board-head p {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .board-head h1 { margin: 0.2rem 0 0; font-size: 1.45rem; }
  .metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
  }
</style>
<header class="board-head">
  <p>Saturday morning</p>
  <h1>Harbor studio board</h1>
</header>

Change --accent once at /css/try. Every figure should follow. If one number stays navy, that card hardcoded a color.

Complete page

Four real metrics and a quiet header. The complete stylesheet keeps variables at the top so you can retint the board without hunting through rules.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Harbor studio — morning board</title>
  <style>
    :root {
      --ink: #0c4a6e;
      --paper: #e0f2fe;
      --card: #fff;
      --accent: #0284c7;
      --muted: #075985;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      min-height: 100vh;
      background: var(--paper);
      color: var(--ink);
      font-family: system-ui, sans-serif;
      padding: 2rem 1.25rem;
    }
    .wrap { max-width: 52rem; margin: 0 auto; }
    .board-head { margin-bottom: 1.2rem; }
    .board-head p {
      margin: 0;
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .board-head h1 {
      margin: 0.25rem 0 0;
      font-size: 1.55rem;
    }
    .metrics {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
      gap: 1rem;
    }
    .metric {
      background: var(--card);
      border-radius: 1rem;
      padding: 1.15rem 1.15rem 1.25rem;
      box-shadow: 0 10px 22px rgba(12, 74, 110, 0.1);
      border-top: 4px solid var(--accent);
    }
    .label {
      margin: 0;
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .figure {
      margin: 0.3rem 0 0.15rem;
      font-size: 2.45rem;
      font-weight: 800;
      color: var(--accent);
      line-height: 1.05;
    }
    .hint {
      margin: 0;
      color: var(--muted);
      font-size: 0.9rem;
    }
  </style>
</head>
<body>
  <div class="wrap">
    <header class="board-head">
      <p>Saturday morning · 8–16</p>
      <h1>Harbor studio board</h1>
    </header>
    <div class="metrics">
      <article class="metric">
        <p class="label">Tables booked</p>
        <p class="figure">12</p>
        <p class="hint">Window side full at 9:30</p>
      </article>
      <article class="metric">
        <p class="label">Loaves out</p>
        <p class="figure">28</p>
        <p class="hint">Sourdough still on the rack</p>
      </article>
      <article class="metric">
        <p class="label">Prints on the line</p>
        <p class="figure">7</p>
        <p class="hint">Menus dry by noon</p>
      </article>
      <article class="metric">
        <p class="label">Espresso pulled</p>
        <p class="figure">41</p>
        <p class="hint">Cafe till 16:00</p>
      </article>
    </div>
  </div>
</body>
</html>

Practice tasks

  1. Set --accent to #0c4a6e. Confirm every figure and top border follows.
  2. Add a fifth metric for Guest passes. Check that the grid wraps instead of overflowing.
  3. Lower the figure size to 1.8rem and decide if the cards still read as stats. Preview at /css/try.

FAQ: CSS Project: Dashboard Cards

Common questions about this page.

What is the StudyGrid CSS tutorial?

The StudyGrid CSS tutorial is a full beginner track: selectors, the box model, text, layout, flex, grid, and responsive design. Each chapter has copy-and-preview examples.

Should I run css dashboard project examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn css dashboard project in this CSS CSS lesson (CSS Project: Dashboard Cards).

Is the CSS editor the same as Try HTML?

No. Try CSS is a stylesheet preview at /css/try. Try HTML stays at /html/try. CSS lessons never open the HTML-only editor or the Python editor.

Do I need to install anything to learn CSS?

No. Open a chapter, click Try it in CSS, and the page preview updates in the browser.

Where should I start the CSS tutorial?

Start at CSS Intro, then Syntax, Selectors, and How To. After colors and the box model, continue to flex, grid, and media queries. Use Next at the bottom of each chapter.

Is the CSS tutorial free?

Yes. The CSS studio on StudyGrid (studygrid.in) is free: dashboard, chapters, and the live preview editor.