<!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>
HTML 结构:
<!DOCTYPE html> 声明文档类型。<html lang="zh-CN"> 设置语言为简体中文。<head> 包含元数据、字符集声明、视口设置和标题。<body> 包含页面的主要内容,包括一个居中的登录表单。CSS 样式:
.login-container 类用于定义登录框的样式,使其居中显示并添加阴影效果。表单功能:
POST 方法提交到 /login 路径(实际路径需要根据后端配置)。required)。上一篇:html居中标签
下一篇:html源码下载
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站