HTML forms

1. Basic Login Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Login Form</title> <style> form { width: 300px; margin: auto; padding: 20px; border: 1px solid #ccc; border-radius: 10px; font-family: Arial, sans-serif; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #ccc; border-radius: 5px; } button { width: 100%; padding: 10px; background-color: blue; color: white; border: none; border-radius: 5px; cursor: pointer; } button:hover { background-color: darkblue; } </style> </head> <body> <form> <h2>Login</h2> <input type="text" placeholder="Username" required> <input type="password" placeholder="Password" required> <button type="submit">Login</button> </form> </body> </html>

2. Registration Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Registration Form</title> <style> form { background: #f9f9f9; padding: 20px; max-width: 400px; margin: 20px auto; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } label { display: block; margin-bottom: 5px; font-weight: bold; } input, select { width: 100%; padding: 8px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 5px; } button { background: green; color: white; padding: 10px; width: 100%; border: none; border-radius: 5px; font-size: 16px; } </style> </head> <body> <form> <h2>Register</h2> <label for="name">Name:</label> <input type="text" id="name" placeholder="Enter your name" required> <label for="email">Email:</label> <input type="email" id="email" placeholder="Enter your email" required> <label for="gender">Gender:</label> <select id="gender" required> <option value="male">Male</option> <option value="female">Female</option> <option value="other">Other</option> </select> <button type="submit">Register</button> </form> </body> </html>

3. Feedback Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Feedback Form</title> <style> form { background-color: #ffe4e1; padding: 20px; border-radius: 5px; max-width: 500px; margin: auto; } textarea { width: 100%; height: 100px; border: 1px solid #ccc; border-radius: 5px; padding: 10px; } button { background-color: red; color: white; padding: 10px 15px; border: none; border-radius: 5px; } </style> </head> <body> <form> <h2>Feedback</h2> <label for="message">Your Message:</label> <textarea id="message" placeholder="Write your feedback here..."></textarea> <button type="submit">Submit</button> </form> </body> </html>

4. Subscription Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Subscription Form</title> <style> form { text-align: center; padding: 20px; border: 2px dashed #333; max-width: 400px; margin: auto; } input[type="email"] { width: 80%; padding: 10px; margin: 10px 0; } button { padding: 10px 20px; background-color: purple; color: white; } </style> </head> <body> <form> <h2>Subscribe to our Newsletter</h2> <input type="email" placeholder="Enter your email" required> <button type="submit">Subscribe</button> </form> </body> </html>

5. Contact Us Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Contact Us Form</title> <style> form { background-color: lightyellow; padding: 20px; max-width: 600px; margin: auto; border-radius: 5px; } input, textarea { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #999; border-radius: 5px; } </style> </head> <body> <form> <h2>Contact Us</h2> <input type="text" placeholder="Name" required> <input type="email" placeholder="Email" required> <textarea placeholder="Your Message" required></textarea> <button type="submit">Send</button> </form> </body> </html>

6. Search Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Search Form</title> <style> form { text-align: center; padding: 20px; } input[type="text"] { padding: 10px; width: 300px; margin-right: 10px; } </style> </head> <body> <form> <input type="text" placeholder="Search..."> <button type="submit">Go</button> </form> </body> </html>

7. Survey Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Survey Form</title> <style> form { padding: 20px; max-width: 400px; margin: auto; background: #f5f5f5; border-radius: 5px; } </style> </head> <body> <form> <h2>Survey</h2> <label>Rate our service:</label><br> <input type="radio" name="rating" value="Excellent"> Excellent<br> <input type="radio" name="rating" value="Good"> Good<br> <input type="radio" name="rating" value="Fair"> Fair<br> <button type="submit">Submit</button> </form> </body> </html>

8. File Upload Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>File Upload</title> <style> form { max-width: 300px; margin: auto; padding: 20px; border: 1px solid #000; } </style> </head> <body> <form> <h2>Upload File</h2> <input type="file"> <button type="submit">Upload</button> </form> </body> 

</html

Comments

Popular posts from this blog

Introduction to Computer

History of Computer

Computer Generation