CSS Blog Post Card

A compact article card with a thumbnail, tag and meta line, where the whole card is one link.

  • blog
  • article
  • post
  • thumbnail
  • horizontal
  • link
HTML
<article class="post-card">
  <div class="post-thumb"></div>
  <div class="post-body">
    <span class="post-tag">Design</span>
    <h3><a href="#">Ten rules for calmer interfaces</a></h3>
    <p>Mar 12 · 5 min read</p>
  </div>
</article>
CSS
.post-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 340px;
  padding: 10px;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  background: #fff;
  font-family: system-ui, sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  border-color: #d4d4d8;
  box-shadow: 0 12px 24px -14px rgba(0, 0, 0, 0.3);
}

.post-card:has(a:focus-visible) {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* Use an <img> here in real projects */
.post-thumb {
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  background: #e4e4e7;
  object-fit: cover;
}

.post-tag {
  color: #7c3aed;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-body h3 {
  margin: 4px 0 6px;
  font-size: 15px;
  line-height: 1.3;
}

.post-body a {
  color: #18181b;
  text-decoration: none;
  outline: none;
}

/* Stretch the link over the whole card */
.post-body a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.post-body p {
  margin: 0;
  color: #71717a;
  font-size: 12px;
}

About this CSS Blog Post Card

This CSS Blog Post Card is 67 lines of pure CSS (1.1 KB) with no JavaScript and no dependencies. It uses transitions, box shadows, Flexbox 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:

  • #e4e4e7
  • #fff
  • #d4d4d8
  • #7c3aed
  • #18181b
  • #71717a

How to use this blog post 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 .post-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