SDC Program 01
SDC Program 01
DJANGO)
reg.css
form {
max-width: 300px;
margin: 0 auto;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 15px;
}
button {
width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<link rel="stylesheet" href="log.css">
<title>Login</title>
</head>
<body>
<div class="container">
<h1>Login Page</h1>
<form>
<input type="text" placeholder="Username" required>
<input type="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</div>
</body>
</html>
Log.css
form {
max-width: 300px;
margin: 0 auto;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 15px;
}
button {
width: 100%;
}
<html>
<html>
<head>
<!-- Include the same header as in home.html -->
</head>
<body bgcolor="yellow" align="center">
<div class="container">
<h2>Catalog Page</h2>
<div class="product">
<img src="product1.jpg" alt="Apple Watch Ultra 2">
<h3>Apple Watch Ultra 2</h3>
<p>Apple Watch Ultra 2 [GPS + Cellular 49mm] Smartwatch with
Rugged Titanium Case
& Blue Alpine Loop Large. Fitness Tracker, Precision GPS, Action
Button,
Extra-Long Battery Life, Bright Retina Display.</p>
<p>Price: $1080.56</p>
<button onclick="addToCart('Product 1', 1080.56)">Add to
Cart</button>
</div>
<div class="product">
<img src="product2.jpg" alt="JBL Cinema SB271">
<h3>JBL Cinema SB271</h3>
<p>JBL Cinema SB271, Dolby Digital Soundbar with Wireless
Subwoofer for
Extra Deep Bass, 2.1 Channel Home Theatre with Remote, HDMI
ARC,
Bluetooth & Optical Connectivity (220W)</p>
<p>Price: $156.24</p>
<button onclick="addToCart('Product 1', 156.24)">Add to
Cart</button>
</div>
<div class="product">
<img src="product3.jpg" alt="Apple iPhone 14 Pro Max">
<h3>Apple iPhone 14 Pro Max</h3>
<p>Apple iPhone 14 Pro Max (512 GB) - Grey</p>
<p>Price: $1670.72</p>
<button onclick="addToCart('Product 1', 1670.72)">Add to
Cart</button>
</div>
</div>
<script>
function addToCart(productName, price) {
var cartItem = { name: productName, price: price };
var cart = JSON.parse(localStorage.getItem('cart')) || [];
cart.push(cartItem);
localStorage.setItem('cart', JSON.stringify(cart));
alert('Product added to cart!');
}
</script>
</body>
</html>
<div class="container">
<h2>Shopping Cart</h2>
<div id="cart-items">
<!-- Cart items will be displayed here -->
</div>
<div class="checkout">
<h3>Total: <span id="cart-total">0.00</span></h3>
<button>Checkout</button>
</div>
</div>
<script>
function displayCart() {
var cart = JSON.parse(localStorage.getItem('cart')) || [];
var cartItemsContainer = document.getElementById('cart-items');
var cartTotalElement = document.getElementById('cart-total');
var cartTotal = 0;
cartItemsContainer.innerHTML = ''; // Clear the previous cart
items
cartTotalElement.textContent = cartTotal.toFixed(2);
}
function removeFromCart(index) {
var cart = JSON.parse(localStorage.getItem('cart')) || [];
if (index >= 0 && index < cart.length) {
cart.splice(index, 1); // Remove the item from the cart array
localStorage.setItem('cart', JSON.stringify(cart));
displayCart(); // Update the cart display
}
}
</body>
</html>
<html >
<head>
<link rel="stylesheet" href="home.CSS">
<title>Home</title>
</head>
<body>
<div class="container">
<h1>Welcome to Our Shopping App</h1>
<div class="navigation">
<ul>
<li><a href="reg.html">Registration</a></li>
<li><a href="login.html">Login page</a></li>
<li><a href="catalog4.html">Catalog</a></li>
<li><a href="cart4.html">Cart</a></li>
</ul>
</div>
</div>
</body>
</html>
Home.css
.navigation ul {
list-style-type: none;
padding: 0;
}
.navigation li {
margin-bottom: 10px;
}
.navigation a {
display: block;
padding: 10px;
text-decoration: none;
background-color: #3498db;
color: white;
}
.navigation a:hover {
background-color: #2980b9;
}
Flex.css
h1 {
text-align: center;
margin-bottom: 20px;
}
.navigation {
display: flex;
flex-direction: column;
align-items: center;
}
.navigation ul {
list-style-type: none;
padding: 0;
}
.navigation li {
margin-bottom: 10px;
width: 100%;
}
.navigation a {
display: block;
padding: 10px;
text-align: center;
text-decoration: none;
background-color: #3498db;
color: white;
}
.navigation a:hover {
background-color: #2980b9;
}
Grid.css
.container {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
min-height: 100vh;
padding: 20px;
}
h1 {
text-align: center;
margin-bottom: 20px;
}
.navigation ul {
list-style-type: none;
padding: 0;
}
.navigation li {
margin-bottom: 10px;
width: 100%;
}
.navigation a {
display: block;
padding: 10px;
text-align: center;
text-decoration: none;
background-color: #3498db;
color: white;
}
.navigation a:hover {
background-color: #2980b9;
}