下面是一个简单的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; } input[type=text], input[type=password] { width: 100%; padding: 12px 20px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; box-sizing: border-box; } button { background-color: #4CAF50; border: none; color: white; padding: 14px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; } </style> </head> <body> <div class="container"> <h2>登录</h2> <form action="/login" method="post"> <!-- 这里应该指向你的后端登录处理逻辑 --> <input type="text" placeholder="用户名" name="username" required> <input type="password" placeholder="密码" name="password" required> <button type="submit">登录</button> <!-- 这里提交表单到后端 --> </form> <!-- 这里结束表单 --> <h2>注册</h2> <!-- 注册表单部分 --> <form action="/register" method="post"> <!-- 这里应该指向你的后端注册处理逻辑 --> <input type="text" placeholder="用户名" name="username" required> <!-- 注册表单的用户名输入框 --> <input type="password" placeholder="密码" name="password" required> <!-- 注册表单的密码输入框 --> <button type="submit">注册</button> <!-- 这里提交表单到后端进行注册 -->