Ad – 728×90
🛠️ CSS Projects

CSS Card Components – 8 Designs with Full Code

Cards are the most versatile UI component — used for products, blog posts, profiles, pricing plans, and dashboards. Each design below uses progressively advanced CSS: basic cards use box model and shadows, profile and pricing cards use flexbox and custom properties, and flip cards use 3D transforms. Build all 8 and you'll have a complete card library for any project.

⏱️ 30 min 🎯 Intermediate 📅 Updated 2026

1. Basic Card

CSS

CSS Flexbox

Master one-dimensional layout with flexbox — align, justify, wrap, and reorder elements.

Read lesson →
CSS – Basic card
.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

2. Media Card (with Image)

🎨

CSS Animations

Build smooth, performant keyframe animations with @keyframes and the animation property.

CSS – Media card
.card-media { border-radius: 10px; overflow: hidden; border: 1px solid #e0e0e0; }
.card-media__img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;      /* crops image to fill without stretching */
  display: block;
}
.card-media__body { padding: 1rem; }
.card-media__body h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.card-media__body p  { margin: 0; font-size: .85rem; color: #666; line-height: 1.5; }
Ad – 336×280

3. Profile Card

👤
Alex Johnson
Front-end Developer
128Lessons
4.9★Rating
2.1kStudents
CSS – Profile card
.card-profile {
  padding: 1.5rem;
  text-align: center;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}
.card-profile__avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  border: 3px solid #1572B6;
}
.card-profile__name  { font-weight: 700; margin-bottom: .25rem; }
.card-profile__role  { font-size: .85rem; color: #666; margin-bottom: .75rem; }
.card-profile__stats { display: flex; justify-content: center; gap: 1.25rem; font-size: .82rem; }
.card-profile__stat strong { display: block; font-size: 1.05rem; font-weight: 700; }

4. Pricing Card

Pro Plan
$12 /month
  • Unlimited lessons
  • Download resources
  • Certificate of completion
  • Priority support
CSS – Pricing card
.card-pricing {
  padding: 1.5rem;
  text-align: center;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  border-top: 4px solid #1572B6; /* accent top border */
}
.card-pricing--popular { border-top-color: #e44d26; }

.card-pricing__price {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: .25rem;
}
.card-pricing__price span { font-size: .9rem; font-weight: 400; color: #666; }

.card-pricing__features {
  list-style: none;
  padding: 0;
  text-align: left;
  margin: .75rem 0;
}
.card-pricing__features li {
  padding: .4rem 0;
  font-size: .85rem;
  border-bottom: 1px solid #e0e0e0;
}
.card-pricing__features li::before { content: '✓  '; color: #2e7d32; font-weight: 700; }

5. Flip Card (3D CSS Transform)

CSS Specificity

Hover to see the answer →

Answer

Score: (IDs, Classes, Elements) — higher wins. !important overrides all.

CSS – Flip card
.flip-card { perspective: 800px; }
.flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}
.flip-card:hover .flip-card__inner { transform: rotateY(180deg); }

.flip-card__front,
.flip-card__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.flip-card__front { background: #1572B6; color: #fff; }
.flip-card__back  { background: #e44d26; color: #fff; transform: rotateY(180deg); }

6. Skeleton Loading Card

CSS – Skeleton card
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}
.skeleton-base {
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
.card-skeleton { border-radius: 10px; overflow: hidden; border: 1px solid #e0e0e0; }
.card-skeleton__img { height: 160px; background: #e0e0e0; }
.card-skeleton__body { padding: 1rem; }
.card-skeleton__line { height: 14px; margin-bottom: 10px; }
.card-skeleton__line--title  { width: 60%; height: 18px; }
.card-skeleton__line--short  { width: 40%; }
.card-skeleton__line--full   { width: 100%; }

7. Glass Morphism Card

CSS – Glass card
/* Needs a colorful background behind it to show the blur effect */
.card-glass {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 1.5rem;
  color: #fff;
}
.card-glass:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0,0,0,.2);
}

8. Horizontal Card

CSS – Horizontal card
.card-h {
  display: flex;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}
.card-h__img {
  width: 140px;
  flex-shrink: 0;
  object-fit: cover;
}
.card-h__body {
  padding: 1rem;
  flex: 1;
}
/* Stack vertically on mobile */
@media (max-width: 480px) {
  .card-h { flex-direction: column; }
  .card-h__img { width: 100%; height: 160px; }
}