HTML Code for Registration Form Using Table
Below is a basic example of an HTML registration form using a table for layout. Note that this form is for demonstration purposes only and lacks server-side validation and security measures.
HTML
<!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>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
table {
max-width: 400px;
width: 100%;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
table, th, td {
border-collapse: collapse;
}
th, td {
padding: 8px;
text-align: left;
}
th {
background-color: #3498db;
color: #fff;
}
input {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #3498db;
color: #fff;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #2980b9;
}
</style>
</head>
<body>
<form action="#" method="post">
<table>
<tr>
<th colspan="2">Registration Form</th>
</tr>
<tr>
<td><label for="username">Username:</label></td>
<td><input type="text" id="username" name="username" required></td>
</tr>
<tr>
<td><label for="email">Email:</label></td>
<td><input type="email" id="email" name="email" required></td>
</tr>
<tr>
<td><label for="password">Password:</label></td>
<td><input type="password" id="password" name="password" required></td>
</tr>
<tr>
<td colspan="2"><button type="submit">Register</button></td>
</tr>
</table>
</form>
</body>
</html>
Remember to replace the `action` attribute in the `<form>` tag with the appropriate URL for processing form submissions on your server. Additionally, implement server-side validation and security measures for a real-world application.
Post a Comment