Create a responsive product card component using semantic HTML and pure CSS (no CSS frameworks). The component must follow a mobile-first approach and be fully functional across different screen sizes.
Requirements
- Use appropriate semantic HTML (article, figure, heading, etc.)
- Mobile-first design with at least one breakpoint for desktop
- Clearly visible hover and focus states for accessibility
- Include product image, name, price, and action button
- No CSS frameworks (Bootstrap, Tailwind, etc.) — only vanilla CSS
Examples
Input:
{ product: { name: "Bluetooth Headphones", price: 49.99, image: "headphones.jpg" } }
Output:
Responsive card displaying the image, name, formatted price, and an "Add to cart" button with visible hover/focus states
Accepted technologies
- HTML5
- CSS3
- Vanilla JavaScript
- TypeScript