PUNITH
PUNITH
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Car Collection</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>My Car Collection</h1>
</header>
<main>
<section id="carCollection">
<div class="car-card">
<img src="car1.jpg" alt="Car 1">
<h2>Car 1</h2>
<p>This is a great car!</p>
<button onclick="removeCar(this)">Remove</button>
</div>
<div class="car-card">
<img src="car2.jpg" alt="Car 2">
<h2>Car 2</h2>
<p>This car is amazing!</p>
<button onclick="removeCar(this)">Remove</button>
</div>
<!-- Add more car divs here -->
</section>
<footer>
<p>My personal car collection website</p>
</footer>
<script src="script.js"></script>
</body>
</html>
CSS
/* Basic Styling */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
text-align: center;
padding: 20px;
}
main {
padding: 20px;
}
#carCollection {
display: flex;
gap: 20px;
flex-wrap: wrap;
}
.car-card {
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
text-align: center;
width: 200px;
transition: transform 0.3s;
}
.car-card img {
width: 100%;
height: auto;
border-radius: 8px;
}
button {
background-color: #d9534f;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #c9302c;
}
#addCarButton {
background-color: #5bc0de;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
margin-top: 20px;
cursor: pointer;
}
#addCarButton:hover {
background-color: #31b0d5;
}
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 10px;
margin-top: 20px;
}
JAVASCRIPT
document.getElementById('addCarButton').addEventListener('click', function()
{
const carCollection = document.getElementById('carCollection');