<!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: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-container {
background-color: white;
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: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
.login-container input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #28a745;
border: none;
color: white;
border-radius: 4px;
cursor: pointer;
}
.login-container input[type="submit"]: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>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
HTML 结构:
<!DOCTYPE html> 声明文档类型为 HTML5。<html lang="zh-CN"> 设置网页语言为简体中文。<head> 包含元数据、字符编码、视口设置和标题。<body> 包含页面的主要内容,包括一个居中的登录表单。CSS 样式:
.login-container 类用于包裹整个登录表单,设置了背景颜色、内边距、圆角和阴影效果。表单:
/login 路径(实际应用中需要根据后端接口进行修改)。required 属性以确保用户必须填写。上一篇:html
下一篇:html的注释
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站