CSS Sale Product Card
A product card for discounts, with a percent-off badge, crossed-out old price and a low-stock meter.
Wireless Headphones
$139 $199
Only 3 left
<article class="sale-card">
<div class="sale-card-media">
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 25'%3E%3Crect width='40' height='25' fill='%23ffe4e6'/%3E%3Cpath d='M13 16v-3a7 7 0 0 1 14 0v3' fill='none' stroke='%23be123c' stroke-width='2.2'/%3E%3Crect x='11' y='14' width='5' height='7' rx='2' fill='%23e11d48'/%3E%3Crect x='24' y='14' width='5' height='7' rx='2' fill='%23e11d48'/%3E%3C/svg%3E" alt="Red wireless headphones" width="200" height="125">
<span class="sale-card-badge">−30%</span>
</div>
<h3><a href="#">Wireless Headphones</a></h3>
<p class="sale-card-price"><ins>$139</ins> <del>$199</del></p>
<p class="sale-card-stock" style="--left: 15%">Only 3 left</p>
</article>
.sale-card {
width: 200px;
padding: 10px 10px 14px;
border-radius: 16px;
background: #fff;
color: #18181b;
font-family: system-ui, sans-serif;
}
.sale-card-media {
position: relative;
margin-bottom: 10px;
}
.sale-card-media img {
display: block;
width: 100%;
height: auto;
border-radius: 10px;
}
.sale-card-badge {
position: absolute;
top: 8px;
left: 8px;
padding: 3px 8px;
border-radius: 6px;
background: #e11d48;
color: #fff;
font-size: 12px;
font-weight: 800;
}
.sale-card h3 {
margin: 0 4px;
font-size: 14px;
font-weight: 600;
}
.sale-card h3 a {
color: inherit;
text-decoration: none;
}
.sale-card h3 a:focus-visible {
outline: 2px solid #e11d48;
outline-offset: 2px;
}
.sale-card-price {
margin: 4px 4px 8px;
}
.sale-card-price ins {
color: #e11d48;
font-size: 18px;
font-weight: 800;
text-decoration: none;
}
.sale-card-price del {
color: #a1a1aa;
font-size: 13px;
}
.sale-card-stock {
margin: 0 4px;
color: #be123c;
font-size: 12px;
font-weight: 600;
}
.sale-card-stock::after {
content: "";
display: block;
height: 5px;
margin-top: 5px;
border-radius: 999px;
background: linear-gradient(90deg, #e11d48 var(--left, 20%), #ffe4e6 0);
}
About this CSS Sale Product Card
This CSS Sale Product Card is 80 lines of pure CSS (1.2 KB) with no JavaScript and no dependencies. It uses linear gradients, keyboard focus styles and custom properties. 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#18181b#e11d48#a1a1aa#be123c#ffe4e6
How to use this sale product card
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.sale-cardclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein 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.