1. Create a new HTML file (e.g., contact.html):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Contact Us</h1>
</header>
<main>
<form id="contactForm">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" required></textarea>
<button type="submit">Submit</button>
</form>
</main>
<script src="script.js"></script>
</body>
</html>
```
2. Create a new CSS file (e.g., styles.css):
```css
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: white;
text-align: center;
padding: 1em 0;
}
main {
max-width: 800px;
margin: 0 auto;
padding: 2em;
}
label {
display: block;
margin-bottom: 0.5em;
}
input,
textarea {
width: 100%;
padding: 0.5em;
margin-bottom: 1em;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 0.5em 1em;
background-color: #333;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #555;
}
```
3. Create a new JavaScript file (e.g., script.js):
```javascript
document.addEventListener("DOMContentLoaded", function () {
const contactForm = document.getElementById("contactForm");
contactForm.addEventListener("submit", function (e) {
e.preventDefault();
// You can add your own code here to handle form submission, like sending an email or storing data.
// For example, you can display a confirmation message:
alert("Thank you for contacting us!");
// Reset the form
contactForm.reset();
});
});
```
Customize the code further based on your specific needs and integrate it into your Blogger website as needed.
Comments
Post a Comment