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

html登录页面

作者:慢靈魂   发布日期:2026-04-14   浏览:63

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML 登录页面</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;
            text-align: center;
        }
        input[type="text"], input[type="password"] {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        input[type="submit"] {
            width: 100%;
            padding: 10px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>登录</h2>
        <form action="/login" method="post">
            <input type="text" placeholder="用户名" name="username" required><br>
            <input type="password" placeholder="密码" name="password" required><br>
            <input type="submit" value="登录">
        </form>
    </div>
</body>
</html>

解释说明:

  1. HTML 结构:

    • <!DOCTYPE html> 声明文档类型。
    • <html lang="zh-CN"> 设置语言为简体中文。
    • <head> 包含元数据、字符集声明、视口设置和标题。
    • <body> 包含页面的主要内容,包括一个居中的登录表单。
  2. CSS 样式:

    • 使用了简单的 CSS 来美化页面,使页面更加整洁美观。
    • .login-container 类用于定义登录框的样式,使其居中显示并添加阴影效果。
    • 输入框和按钮的样式也进行了定义,使其看起来更友好。
  3. 表单功能:

    • 表单使用 POST 方法提交到 /login 路径(实际路径需要根据后端配置)。
    • 用户名和密码字段是必填项 (required)。
    • 提交按钮点击后会将表单数据发送到服务器进行验证。

上一篇:html居中标签

下一篇:html源码下载

大家都在看

静态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 中文站