下面是一个简单的 HTML 注册和登录页面的设计示例。请注意,这只是一个基本的示例,不包含任何后端代码或验证。在实际应用中,您可能需要添加更多的功能和安全性措施。
HTML 代码:
<!DOCTYPE html> <html> <head> <title>注册和登录页面</title> <style> body { font-family: Arial, sans-serif; } .container { width: 300px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; border-radius: 5px; } h2 { text-align: center; } label { display: block; margin-bottom: 10px; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; border-radius: 5px; border: 1px solid #ccc; } input[type="submit"] { width: 100%; background-color: #4CAF50; color: white; padding: 10px; border: none; border-radius: 5px; cursor: pointer; } input[type="submit"]:hover { background-color: #45a049; } </style> </head> <body> <div class="container"> <h2>注册</h2> <form action="/register" method="post"> <label for="username">用户名:</label><br> <input type="text" id="username" name="username" required><br> <label for="password">密码:</label><br> <input type="password" id="password" name="password" required><br> <input type="submit" value="注册"> </form> <h2>登录</h2> <form action="/login" method="post"> <label for="username">用户名:</label><br> <input type="text" id="username" name="username" required><br> <label for="password">密码:</label><br> <input type="password" id="password" name="password" required><br> <input type="submit" value="登录"> </form> </div> <!-- End of container --> </body> <!-- End of body --> </html> <!-- End of HTML --> ```在这个示例中,我们创建了一个简单的注册和登录页面,其中包含两个表单,每个表单都有一个文本输入框用于输入用户名和密码,以及一个提交按钮用于提交表单,这个示例中的表单没有实际的提交目标(action),在实际应用中,你需要将其指向适当的后端处理逻辑,这个示例也没有包含任何前端验证或后端处理逻辑,你需要根据实际需求进行添加。