Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <style> /* This container is optional, but helps center the form on the page */ .single-column-container { max-width: 500px; margin: 30px auto; padding: 25px; background: #fdfdfd; border: 1px solid #e0e0e0; border-radius: 8px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; } .single-column-container h2 { text-align: center; margin-bottom: 25px; } /* Each label + input pairing */ .form-group { margin-bottom: 20px; } .form-group label { display: block; /* Ensures label is on its own line */ margin-bottom: 8px; font-weight: 600; } .form-group input, .form-group textarea { width: 100%; /* Makes the input take the full width of the container */ padding: 12px; border: 1px solid #ccc; border-radius: 5px; font-size: 1rem; box-sizing: border-box; /* Ensures padding is included in the width */ } .form-group textarea { height: 120px; resize: vertical; } .submit-btn { display: block; width: 100%; padding: 12px; border: none; background: #333; color: white; font-weight: bold; font-size: 1.1rem; border-radius: 5px; cursor: pointer; transition: background-color 0.2s; } .submit-btn:hover { background: #555; } </style> <div class="single-column-container"> <h2>Get in Touch</h2> <form action="#" method="post"> <div class="form-group"> <label for="name">Your Name</label> <input type="text" id="name" name="name" required> </div> <div class="form-group"> <label for="email">Your Email</label> <input type="email" id="email" name="email" required> </div> <div class="form-group"> <label for="phone">Your Phone</label> <input type="tel" id="phone" name="phone"> </div> <div class="form-group"> <label for="message">Message</label> <textarea id="message" name="message" required></textarea> </div> <button type="submit" class="submit-btn">Submit</button> </form> </div>