Set width: full 320 480 640 768 1024 1920 custom
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple HTML Contact Form</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 2rem;
background: #f7f7f7;
}
.contact-form-container {
max-width: 400px;
margin: 0 auto;
background: #fff;
border-radius: 10px;
box-shadow: 0 4px 16px rgba(0,0,0,0.07);
padding: 2rem 1.5rem 1.5rem 1.5rem;
}
.contact-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.contact-form label {
font-weight: 500;
margin: .5rem 0 0;
}
.contact-form input,
.contact-form textarea {
padding: 0.7rem 1rem;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
resize: vertical;
}
.contact-form textarea {
min-height: 90px;
max-height: 220px;
}
.contact-form button {
padding: 0.75rem 1.5rem;
background: #0078d7;
color: #fff;
border: none;
border-radius: 4px;
font-size: 1rem;
cursor: pointer;
transition: background 0.2s;
}
.contact-form button:hover {
background: #005fa3;
}
.form-success {
color: #0078d7;
margin-top: 1rem;
text-align: center;
display: none;
}
@media (max-width: 500px) {
body { padding: 1rem; }
.contact-form-container { padding: 1rem; }
}
</style>
</head>
<body>
<div class="contact-form-container">
<form class="contact-form" id="contactForm">
<label for="name">Name</label>
<input type="text" id="name" name="name" required autocomplete="name">
<label for="email">Email</label>
<input type="email" id="email" name="email" required autocomplete="email">
<label for="message">Message</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Send Message</button>
</form>
<div class="form-success" id="formSuccess">Thank you! Your message has been sent.</div>
</div>
<script>
const form = document.getElementById('contactForm');
const success = document.getElementById('formSuccess');
form.addEventListener('submit', function(e) {
e.preventDefault();
form.reset();
success.style.display = 'block';
setTimeout(() => { success.style.display = 'none'; }, 3000);
});
</script>
</body>
</html>