
2025-08-13 — By Siddharth Jain · 8 min read
Modern dashboards and apps rely on cards—compact UI blocks that group relevant information and make it visually appealing.
In this blog post, we’ll deep dive into building a stylish and interactive activity card from scratch using HTML, CSS variables, and SVG icons.
We’ll go over:
The sample card displays:
Best Uses:
Here’s the main HTML layout:
Play 32hrs Last Week - 36hrs
Key Parts:
.img-section → Holds the top SVG icon with background color.card-desc → Contains title, menu dots, time, and stats.card-menu → Three small dots often used for a "settings" or "more" menu.card-time → Main data display.recent → Last week’s data for contextWe make heavy use of CSS variables for easy color control:
.card {
--primary-clr: #1c204b;
--dot-clr: #bbc0ff;
--play: hsl(195, 74%, 62%);
width: 200px;
height: 170px;
border-radius: 10px;
font-family: "Arial";
color: #fff;
display: grid;
grid-template-rows: 50px 1fr;
cursor: pointer;
}
.img-section {
background: var(--play); /* aqua-blue */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.card:hover .img-section {
transform: translateY(1em); /* moves down slightly */
}
Creates the sliding hover effect.
.card-desc {
background: var(--primary-clr);
border-radius: 10px;
padding: 15px;
position: relative;
top: -10px;
display: grid;
gap: 10px;
}
Visually overlaps with top section for a layered effect.
.card .dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--dot-clr);
}
Perfect for minimalist interface menus.
The .img-section smoothly animates downwards when hovering over the card:
.card:hover .img-section {
transform: translateY(1em);
}
--primary-clr for dark/light theme adaptabilitywidth and heighttransition propertyJust update the CSS variable:
.card.work .img-section {
background: hsl(15, 100%, 70%); /* Warm orange for work */
}
And change title to Work, icon to a laptop or briefcase SVG.
This interactive activity card design:
You can use multiple instances in a grid for a complete dashboard layout.
💡 Pro Tip: Add box-shadow and slight scale() on hover for an even more dynamic feel.