HTML代码。
<!DOCTYPE html> <html> <head> <title>百度注册页面</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="container"> <h2>百度注册</h2> <form action="/register" method="post"> <div class="input-group"> <label for="username">用户名:</label> <input type="text" id="username" name="username" required> </div> <div class="input-group"> <label for="password">密码:</label> <input type="password" id="password" name="password" required> </div> <div class="input-group"> <label for="email">邮箱:</label> <input type="email" id="email" name="email" required> </div> <div class="input-group checkbox"> <input type="checkbox" id="agree" name="agree" required> <label for="agree">我同意百度服务条款</label> </div> <button type="submit">注册</button> </form> </div> </body> </html>
CSS代码(保存为styles.css文件):
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-group { margin-bottom: 10px; } label { display: block; margin-bottom: 5px; } input[type="text"], input[type="password"], input[type="email"] { width: 100%; padding: 10px; border-radius: 3px; border: 1px solid #ccc; } input[type="checkbox"] + label { display: inline-block; margin-left: 10px; } button[type="submit"] { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 3px; cursor: pointer; }
这只是一个简单的注册页面示例,不包含实际的注册逻辑和后端处理,在实际应用中,你需要将此表单与后端服务器进行交互以实现注册功能,还需要添加适当的验证和安全性措施来保护用户数据。