Laravel  
laravel
文档
数据库
架构
入门
php技术
    
Laravelphp
laravel / php / java / vue / mysql / linux / python / javascript / html / css / c++ / c#

登录页面的html代码

作者:刎心封爱为伱锁情   发布日期:2026-01-31   浏览:18

<!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;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
        }
        .form-group input {
            width: 100%;
            padding: 8px;
            box-sizing: border-box;
        }
        .form-group button {
            width: 100%;
            padding: 10px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        .form-group button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>登录</h2>
        <form action="/login" method="POST">
            <div class="form-group">
                <label for="username">用户名:</label>
                <input type="text" id="username" name="username" required>
            </div>
            <div class="form-group">
                <label for="password">密码:</label>
                <input type="password" id="password" name="password" required>
            </div>
            <div class="form-group">
                <button type="submit">登录</button>
            </div>
        </form>
    </div>
</body>
</html>

解释说明:

  1. HTML结构:

    • 使用了标准的HTML5文档结构,包含<html>, <head>, 和 <body>标签。
    • <form>标签用于创建登录表单,action="/login"表示提交表单时的目标URL,method="POST"表示使用POST方法提交数据。
  2. CSS样式:

    • 使用内联<style>标签定义了一些简单的样式,使页面看起来更美观。
    • body设置了背景颜色和居中的布局,使登录框位于屏幕中央。
    • .login-container类定义了登录框的样式,包括背景颜色、内边距、圆角和阴影效果。
    • .form-group类用于组织表单元素,使其布局整齐。
  3. 表单元素:

    • 包含两个输入框,分别用于输入用户名和密码,均设置为必填项(required属性)。
    • 提交按钮使用了<button>标签,并设置了点击后的背景颜色变化效果。

上一篇:html轮播图

下一篇:html5的doctype

大家都在看

静态html源码

404 html

ios打开html

nginx访问不到html

html 符号

colspan在html中是什么意思

怎么将网页另存为html

xml转html

html时间代码

html localstorage

Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3

Laravel 中文站