Advanced HTML & CSS
This commit is contained in:
45
Week-02/Day_01/index.html
Normal file
45
Week-02/Day_01/index.html
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Advanced HTML & CSS - Simple Form</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<form class="form" id="userForm">
|
||||||
|
<h3>User Form</h3>
|
||||||
|
|
||||||
|
<input type="text" id="name" name="name" placeholder="Name" required>
|
||||||
|
<input type="email" id="email" name="email" placeholder="Email" required>
|
||||||
|
<input type="text" id="city" name="city" placeholder="City">
|
||||||
|
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="display">
|
||||||
|
<h3>Entered Details</h3>
|
||||||
|
<p>Name: <span id="displayName">______</span></p>
|
||||||
|
<p>Email: <span id="displayEmail">______</span></p>
|
||||||
|
<p>City: <span id="displayCity">______</span></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('userForm').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var name = document.getElementById('name').value.trim();
|
||||||
|
var email = document.getElementById('email').value.trim();
|
||||||
|
var city = document.getElementById('city').value.trim();
|
||||||
|
|
||||||
|
document.getElementById('displayName').textContent = name || '______';
|
||||||
|
document.getElementById('displayEmail').textContent = email || '______';
|
||||||
|
document.getElementById('displayCity').textContent = city || '______';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
32
Week-02/Day_01/style.css
Normal file
32
Week-02/Day_01/style.css
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
body {
|
||||||
|
font-family: Arial;
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
width: 500px;
|
||||||
|
margin: 50px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
background: white;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.display {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
background: white;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, button {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user