contact us
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Contact Us - My Blog</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f9f9f9;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.contact-container {
background: white;
padding: 30px;
max-width: 500px;
width: 90%;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
border-radius: 8px;
}
h1 {
margin-bottom: 20px;
color: #333;
text-align: center;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
input, textarea {
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical;
font-size: 16px;
}
textarea {
min-height: 100px;
}
button {
background-color: #007BFF;
color: white;
font-weight: bold;
padding: 12px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
.success-message {
color: green;
margin-top: 10px;
text-align: center;
font-weight: bold;
}
</style>
</head>
<body>
<div class="contact-container">
<h1>Contact Us</h1>
<form id="contactForm">
<label for="name">Name</label>
<input type="text" id="name" name="name" required placeholder="Your name" />
<label for="email">Email</label>
<input type="email" id="email" name="email" required placeholder="Your email" />
<label for="message">Message</label>
<textarea id="message" name="message" required placeholder="Write your message here..."></textarea>
<button type="submit">Send Message</button>
</form>
<div id="successMessage" class="success-message" style="display:none;">
Thanks for contacting us! We'll get back to you soon.
</div>
</div>
<script>
const form = document.getElementById('contactForm');
const successMessage = document.getElementById('successMessage');
form.addEventListener('submit', (e) => {
e.preventDefault();
// Here you could add actual form submission logic (e.g., send to server)
// For demo, just show the success message and reset the form
successMessage.style.display = 'block';
form.reset();
});
</script>
</body>
</html>
No comments:
Post a Comment