<!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>
HTML结构:
<html>, <head>, 和 <body>标签。<form>标签用于创建登录表单,action="/login"表示提交表单时的目标URL,method="POST"表示使用POST方法提交数据。CSS样式:
<style>标签定义了一些简单的样式,使页面看起来更美观。body设置了背景颜色和居中的布局,使登录框位于屏幕中央。.login-container类定义了登录框的样式,包括背景颜色、内边距、圆角和阴影效果。.form-group类用于组织表单元素,使其布局整齐。表单元素:
required属性)。<button>标签,并设置了点击后的背景颜色变化效果。上一篇:html轮播图
下一篇:html5的doctype
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站