Kavin Ssa2
Kavin Ssa2
Name : KAVIN. N
Year / Sec : I / C4
Marks Awarded:
Objective:
Problem Analysis:
The challenge is to create a responsive, lightweight, and visually engaging card that
adapts well to various devices and screen sizes, while also being easy to integrate
into any website.
1. HTML: For structuring the card elements, such as the image, product
name, description, and price.
2. CSS: For styling the card, including layout, colors, fonts, and the hover
effect.
1. Compact Design: The card displays the image, product name, short
description, and price, all within a small frame.
2. Hover Effect: A subtle scaling and shadow effect on hover improves the
visual appeal.
!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Product Card</title>
<style>
/* General styling */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
margin: 0;
.product-card {
width: 300px;
background: #fff;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
/* Hover effect */
.product-card:hover {
transform: scale(1.05);
/* Product image */
.product-card img {
width: 100%;
height: 200px;
object-fit: cover;
/* Product details */
.product-details {
padding: 20px;
}
.product-details h2 {
font-size: 1.25rem;
margin: 0;
color: #333;
.product-details p {
font-size: 1rem;
color: #666;
margin: 10px 0;
.product-details .price {
font-size: 1.2rem;
font-weight: bold;
color: #28a745;
</style>
</head>
<body>
<div class="product-card">
<div class="product-details">
<h2>Product Name</h2>
<div class="price">$29.99</div>
</div>
</div>
</body>
</html>
Output:
Results:
Visually Engaging: The hover effect makes the card stand out, drawing user
attention to each product.
Responsive and Compact: The card layout adjusts to different screen sizes,
making it ideal for desktop and mobile views.
Conclusion:
References
For more on creating responsive and interactive product cards, refer to: