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

登录页面html模板

作者:暗夜幽殤   发布日期:2025-06-17   浏览:76

<!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: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .login-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
            text-align: center;
        }
        .login-container h2 {
            margin-bottom: 20px;
        }
        .login-container input[type="text"],
        .login-container input[type="password"] {
            width: calc(100% - 20px);
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .login-container button {
            width: 100%;
            padding: 10px;
            background-color: #28a745;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .login-container button:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>登录</h2>
        <form action="/login" method="POST">
            <input type="text" name="username" placeholder="用户名" required>
            <input type="password" name="password" placeholder="密码" required>
            <button type="submit">登录</button>
        </form>
    </div>
</body>
</html>

解释说明:

  1. HTML结构:

    • <!DOCTYPE html>: 声明文档类型为HTML5。
    • <html lang="zh-CN">: 设置网页语言为简体中文。
    • <head>: 包含网页的元数据,如字符编码、视口设置和标题。
    • <body>: 包含网页的主要内容。
  2. CSS样式:

    • 使用内联<style>标签定义了页面的基本样式,包括背景颜色、字体、居中对齐等。
    • .login-container: 定义了一个登录框的样式,设置了背景色、内边距、圆角和阴影效果。
    • 输入框和按钮的样式也进行了简单的美化。
  3. 表单元素:

    • 使用<form>标签创建了一个表单,action="/login"指定了表单提交的目标URL,method="POST"表示使用POST方法提交数据。
    • 表单中有两个输入框,分别用于输入用户名和密码,并且都设置了required属性以确保用户必须填写这些字段。
    • 提交按钮使用<button>标签创建,点击后会提交表单。

这个模板提供了一个简单而美观的登录页面,适用于大多数Web应用程序。

上一篇:html转义符

下一篇:html中display

大家都在看

静态html源码

ios打开html

colspan在html中是什么意思

xml转html

html时间代码

html2canvas使用

html标题标签是什么

html 换行符号

html中b标签的作用

html美化代码

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

Laravel 中文站