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.
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
- Promotional Tag: A bright, eye-catching badge is positioned over the product image to instantly signal a sale.
- Discounted Price Display: Clearly shows the new, lower price alongside the original price, which has a strikethrough effect for clarity.
- Semantic Pricing: The original price is wrapped in a
deltag, which semantically indicates deleted or "old" content. - Standard Product Features: Retains all the features of a standard product card, including the responsive layout and separate call-to-action button.
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.