Product Card with Discount Tag

Highlight sales and promotions effectively with this product card featuring a prominent discount tag and a "before and after" price display.

This component builds on the standard product card, adding visual elements designed to attract customer attention and communicate value clearly.

Screenshot of three product cards, each with a red discount tag and a sale price.

Get Source Code Preview

About this Component

This card is similar to the standard product card, but it adds two features for promotional pricing. The first is an absolutely positioned badge overlaid on the image. The second is a styled price block showing both the new sale price and the old, struck-through price. This provides an immediate, clear visual indicator of a discount.

Features

Code Breakdown

HTML Structure

The card begins with a div with the class .pdc-discount-tag; this element will be positioned over the image. In the footer, the prices are grouped within a .pdc-price-wrapper. The sale price is in a span, while the original price uses the del element to achieve the semantic strikethrough.

CSS Styling

The main card (.pdc-card) is given position: relative. This allows the .pdc-discount-tag, which has position: absolute, to be positioned relative to the card's corners using the top and left properties. In the price block, the original price class (.pdc-original-price) is styled with text-decoration: line-through and a muted color to de-emphasize it, making the new sale price stand out more prominently.

Code

Here is the complete, self-contained code. You can customize the discount tag's text (e.g., "Sale", "-25%") and update the pricing as needed for your products.

View Output