CSS Article Card

A vertical blog article card with a cover image, category, clamped excerpt and author line, all one link.

  • blog
  • article
  • post
  • excerpt
  • author
  • clickable card
HTML
<article class="article-card">
  <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 16'%3E%3Crect width='40' height='16' fill='%23a5f3fc'/%3E%3Ccircle cx='29' cy='5' r='3' fill='%23fde047'/%3E%3Cpath d='M0 16v-6l9-4 8 5 7-3 16 8z' fill='%230d9488'/%3E%3Cpath d='M0 16l14-4 10 2 7-1 9 3z' fill='%23115e59'/%3E%3C/svg%3E" alt="" width="250" height="100">
  <div class="article-card-body">
    <p class="article-card-cat">Engineering</p>
    <h3><a href="#">How we cut our CSS bundle in half</a></h3>
    <p class="article-card-excerpt">A practical look at cascade layers, container queries and finally deleting old code.</p>
    <p class="article-card-meta">Rae Tan · Oct 4 · 7 min read</p>
  </div>
</article>
CSS
.article-card {
  position: relative;
  width: 250px;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-family: system-ui, sans-serif;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.article-card:hover {
  box-shadow: 0 14px 30px -12px rgba(15, 23, 42, 0.25);
  transform: translateY(-3px);
}

.article-card img {
  display: block;
  width: 100%;
  height: auto;
}

.article-card-body {
  padding: 12px 16px 16px;
}

.article-card-cat {
  margin: 0;
  color: #0d9488;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.article-card h3 {
  margin: 4px 0 6px;
  font-size: 16px;
  line-height: 1.3;
}

.article-card h3 a {
  color: inherit;
  text-decoration: none;
}

.article-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.article-card:has(a:focus-visible) {
  outline: 3px solid #0d9488;
  outline-offset: 3px;
}

.article-card h3 a:focus-visible {
  outline: none;
}

.article-card-excerpt {
  display: -webkit-box;
  margin: 0 0 10px;
  overflow: hidden;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.article-card-meta {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .article-card {
    transition: none;
  }

  .article-card:hover {
    transform: none;
  }
}

About this CSS Article Card

This CSS Article Card is 88 lines of pure CSS (1.4 KB) with no JavaScript and no dependencies. It uses transitions, transforms, box shadows and the :has() selector. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #fff
  • #0f172a
  • #0d9488
  • #475569
  • #94a3b8

How to use this article card

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .article-card class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback