-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.html
159 lines (137 loc) · 3.64 KB
/
cart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shopping Cart</title>
<style>
/* styles.css */
body {
font-family: cursive;
margin: 0;
padding: 0;
}
header {
background-color: #645252;
color: white;
text-align: center;
padding: 20px 0;
}
.cart {
max-width: 800px;
margin: 20px auto;
padding: 20px;
border: 1px solid #f4c5c5;
background-color: #f4b1b1;
}
.cart-item {
display: flex;
margin-bottom: 20px;
}
.cart-item img {
width: 100px;
height: 100px;
margin-right: 20px;
}
.cart-item-info {
background-image: url(shoe01.jpg);
position: relative;
}
.cart-item-info1 {
background-image: url(shoe02.jppg.jpg);
position: absolute;
}
.description {
font-size: 14px;
margin-top: 5px;
color: #777;
}
.price {
font-weight: bold;
margin: 10px 0;
}
.quantity {
margin-top: 10px;
}
.cart-item-remove {
cursor: pointer;
color: red;
font-weight: bold;
margin-top: 10px;
display: block;
}
.total-cost {
text-align: right;
font-weight: bold;
font-size: 18px;
margin-top: 20px;
}
.checkout {
text-align: center;
margin-top: 20px;
}
button {
background-color: #007bff;
color: white;
padding: 10px 20px;
font-size: 16px;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<header>
<h1>Shopping Cart</h1>
</header>
<section class="cart">
<div class="cart-item">
<div class="cart-item-info">
<h3>Product 1</h3>
<p class="description">Lorem ipsum dolor sit amet.</p>
<p class="price">$10.00</p>
<div class="quantity">
<label for="quantity1">Quantity:</label>
<input type="number" id="quantity1" value="1">
</div>
<span class="cart-item-remove" onclick="removeItem(1)">Remove</span>
</div>
</div>
<div class="cart-item">
<div class="cart-item-info1">
<h3>Product 2</h3>
<p class="description">Consectetur adipiscing elit.</p>
<p class="price">$15.00</p>
<div class="quantity">
<label for="quantity2">Quantity:</label>
<input type="number" id="quantity2" value="1">
</div>
<span class="cart-item-remove" onclick="removeItem(2)">Remove</span>
</div>
</div>
<div class="total-cost">
Total: $<span id="total">25.00</span>
</div>
</section>
<script>
// JavaScript functions for cart interactions
function removeItem(itemId) {
// Remove the item from the cart (not implemented in this example)
// You would need a more complex data structure to manage items in a real system
alert("Item removed from cart. Refresh the page to update.");
}
function updateTotal() {
// Calculate and update the total cost based on item quantities (not implemented in this example)
// You would need to access item quantities and prices from your data model
alert("Total updated. Refresh the page to see changes.");
}
function checkout() {
// Redirect to the checkout page or perform other checkout actions (not implemented in this example)
alert("Redirecting to checkout...");
}
</script>
</body>
</html>