UI Components Easy
User Profile Card
A SaaS-style user profile card with avatar, cover image, name, role, stats, and action buttons.
Open in Lab
MCP
css
Targets: HTML
Code
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: system-ui, -apple-system, sans-serif;
background: #0f172a;
color: #f1f5f9;
min-height: 100vh;
display: grid;
place-items: center;
padding: 2rem;
}
/* โโ Card shell โโ */
.profile-card {
width: 320px;
background: #141e33;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 1.25rem;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
transition: box-shadow 0.25s ease;
}
.profile-card:hover {
box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
}
/* โโ Cover image โโ */
.profile-card__cover {
width: 100%;
height: 120px;
background: linear-gradient(135deg, #1e3a5f 0%, #0d2d52 40%, #1a1060 100%);
position: relative;
flex-shrink: 0;
}
/* โโ Avatar wrapper โโ */
.profile-card__avatar-wrap {
position: relative;
margin-top: -40px;
z-index: 1;
}
.profile-card__avatar {
width: 80px;
height: 80px;
border-radius: 50%;
background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
border: 3px solid #141e33;
display: grid;
place-items: center;
font-size: 1.375rem;
font-weight: 700;
color: #fff;
letter-spacing: 0.02em;
user-select: none;
}
/* โโ Online status dot โโ */
.profile-card__status {
position: absolute;
bottom: 4px;
right: 4px;
width: 14px;
height: 14px;
border-radius: 50%;
background: #22c55e;
border: 2.5px solid #141e33;
}
/* โโ Info block โโ */
.profile-card__info {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.3rem;
padding: 0.875rem 1.5rem 0;
text-align: center;
}
.profile-card__name {
font-size: 1.0625rem;
font-weight: 700;
color: #f1f5f9;
line-height: 1.2;
}
.profile-card__role {
font-size: 0.8125rem;
color: #94a3b8;
}
.profile-card__team {
display: inline-flex;
align-items: center;
gap: 0.3rem;
font-size: 0.75rem;
font-weight: 500;
color: #38bdf8;
background: rgba(56, 189, 248, 0.1);
padding: 0.2em 0.65em;
border-radius: 9999px;
margin-top: 0.125rem;
}
/* โโ Stats row โโ */
.profile-card__stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
width: 100%;
border-top: 1px solid rgba(255, 255, 255, 0.06);
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
margin-top: 1.25rem;
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.2rem;
padding: 1rem 0.5rem;
}
.stat-item + .stat-item {
border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.stat-item__value {
font-size: 1.0625rem;
font-weight: 700;
color: #f1f5f9;
}
.stat-item__label {
font-size: 0.7rem;
font-weight: 500;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.04em;
}
/* โโ Action buttons โโ */
.profile-card__actions {
display: flex;
gap: 0.75rem;
padding: 1.125rem 1.5rem 1.375rem;
width: 100%;
}
.btn {
flex: 1;
padding: 0.55rem 1rem;
border-radius: 0.625rem;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
border: none;
transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}
.btn:active {
transform: scale(0.97);
}
.btn--primary {
background: #38bdf8;
color: #0c1a2e;
}
.btn--primary:hover {
background: #7dd3fc;
box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
}
.btn--ghost {
background: transparent;
color: #94a3b8;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn--ghost:hover {
background: rgba(255, 255, 255, 0.05);
color: #e2e8f0;
border-color: rgba(255, 255, 255, 0.16);
}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>User Profile Card</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="profile-card">
<!-- Cover image area -->
<div class="profile-card__cover" aria-hidden="true"></div>
<!-- Avatar with online status -->
<div class="profile-card__avatar-wrap">
<div class="profile-card__avatar" aria-label="Avatar for Sarah Johnson">SJ</div>
<span class="profile-card__status" aria-label="Online"></span>
</div>
<!-- Name / role / team -->
<div class="profile-card__info">
<h2 class="profile-card__name">Sarah Johnson</h2>
<p class="profile-card__role">Senior Product Designer</p>
<span class="profile-card__team">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
<circle cx="9" cy="7" r="4"/>
<path d="M23 21v-2a4 4 0 0 0-3-3.87"/>
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
</svg>
Product Team
</span>
</div>
<!-- Stats row -->
<div class="profile-card__stats">
<div class="stat-item">
<span class="stat-item__value">128</span>
<span class="stat-item__label">Projects</span>
</div>
<div class="stat-item">
<span class="stat-item__value">4.9k</span>
<span class="stat-item__label">Followers</span>
</div>
<div class="stat-item">
<span class="stat-item__value">321</span>
<span class="stat-item__label">Reviews</span>
</div>
</div>
<!-- Action buttons -->
<div class="profile-card__actions">
<button class="btn btn--primary" type="button">Follow</button>
<button class="btn btn--ghost" type="button">Message</button>
</div>
</div>
</body>
</html>User Profile Card
A polished SaaS-style user profile card built with pure CSS. Features a gradient cover image, an overlapping avatar with an online status indicator, role and team information, key stat counts, and a pair of action buttons โ all within a compact 320px card.
Features
- Pure CSS โ zero JavaScript required
- Gradient cover area with overlapping circular avatar using initials
- Live online status dot indicator on the avatar
- Three-column stats row for projects, followers, and reviews
- Primary โFollowโ button and ghost โMessageโ button pair