Optimize CSS for dashboard stats item with highlight and notice sections

by Jordan Sayner

HTML

<div class="dashboard-hero__stats-item dashboard-hero__stats-item--highlight">
    <div class="dashboard-hero__stats-label header-6">
        Points:
    </div>
    <div class="dashboard-hero__stats-number header-1">
        3200
    </div>
    <div class="dashboard-hero__stats-item-notice">
        <p>You have <strong>220</strong> points expiring in 30 Days.</p>
        <a href="" title="">Redeem Now</a>
    </div>
</div>

CSS

.dashboard-hero__stats-item {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

/* Only the middle one needs the tab */
.dashboard-hero__stats-item--highlight {
    padding-bottom: 0; // we’ll let the red bar be the “bottom”
}

.dashboard-hero__stats-item-notice {
    margin: 1.25rem -1.5rem -1.5rem;  // bleed out of the padding + pop out
    padding: 0.85rem 1.5rem;
    background: #cc0022;              // red strip
    color: #fff;
    border-radius: 0 0 0.75rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

.dashboard-hero__stats-item-notice a {
    color: inherit;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    white-space: nowrap;
}