<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f2f2f2;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .login-container {
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
        }
        .login-container h2 {
            margin-bottom: 20px;
            text-align: center;
        }
        .input-group {
            margin-bottom: 15px;
        }
        .input-group label {
            display: block;
            margin-bottom: 5px;
        }
        .input-group input {
            width: 100%;
            padding: 8px;
            box-sizing: border-box;
        }
        .btn {
            width: 100%;
            padding: 10px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        .btn:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>登录</h2>
        <form action="/submit_login" 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>
            <button type="submit" class="btn">登录</button>
        </form>
    </div>
</body>
</html>HTML 结构:
<!DOCTYPE html> 声明文档类型为 HTML5。<html lang="zh-CN"> 设置网页语言为中文。<head> 部分包含字符集、视口设置、标题和样式定义。<body> 包含登录表单的内容。CSS 样式:
.login-container 类用于包裹整个登录表单,设置了背景颜色、内边距、圆角和阴影效果。.input-group 类用于包裹输入框及其标签,确保输入框和标签之间的间距一致。.btn 类用于设置按钮的样式,包括背景颜色、文字颜色、边框、圆角等。表单元素:
<form> 标签,action="/submit_login" 指定了表单提交的 URL(实际应用中需要根据实际情况修改)。<input type="text"> 和 <input type="password"> 实现。<button type="submit"> 实现,点击后会提交表单数据。响应式设计:
display: flex; justify-content: center; align-items: center;) 来确保页面在不同屏幕尺寸下都能居中显示。上一篇:html导航栏怎么做
下一篇:html标记
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站