<!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>
HTML结构:
<!DOCTYPE html>
: 声明文档类型为HTML5。<html lang="zh-CN">
: 设置网页语言为简体中文。<head>
: 包含网页的元数据,如字符编码、视口设置和标题。<body>
: 包含网页的主要内容。CSS样式:
<style>
标签定义了页面的基本样式,包括背景颜色、字体、居中对齐等。.login-container
: 定义了一个登录框的样式,设置了背景色、内边距、圆角和阴影效果。表单元素:
<form>
标签创建了一个表单,action="/login"
指定了表单提交的目标URL,method="POST"
表示使用POST方法提交数据。required
属性以确保用户必须填写这些字段。<button>
标签创建,点击后会提交表单。这个模板提供了一个简单而美观的登录页面,适用于大多数Web应用程序。
上一篇:html转义符
下一篇:html中display
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站