用html写一个登陆页面
时间: 2023-09-20 11:12:41 浏览: 40
以下是一个简单的登录页面的 HTML 代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h2>Login</h2>
<form action="login.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<input type="submit" value="Login">
</form>
</body>
</html>
```
这个页面包含一个登录表单,其中包括一个用户名输入框和一个密码输入框,以及一个提交按钮。当用户点击提交按钮时,表单会将输入的用户名和密码发送到服务器上的 login.php 文件进行验证。
相关问题
用html 写一个登陆页面
好的,以下是一个使用HTML写的登录页面示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
color: #333;
}
h1 {
text-align: center;
margin-top: 50px;
}
form {
margin: 50px auto;
padding: 20px;
max-width: 500px;
border: 1px solid #ccc;
background-color: #fff;
}
input[type="text"], input[type="password"] {
display: block;
margin-bottom: 20px;
padding: 10px;
width: 100%;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
box-sizing: border-box;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
float: right;
font-size: 16px;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
</style>
</head>
<body>
<h1>登录页面</h1>
<form action="#" method="post">
<label>用户名</label>
<input type="text" name="username" required>
<label>密码</label>
<input type="password" name="password" required>
<input type="submit" value="登录">
</form>
</body>
</html>
```
当用户在用户名和密码输入框中输入信息并提交表单时,可以将数据发送到指定的服务端进行验证。在这个示例中,表单的action属性值为“#”,可以被改为实际的服务端地址。
用html写一个登陆页面 包括用户名 密码 和登录按钮
当然可以!以下是一个简单的 HTML 登录页面的示例代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
width: 300px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.container input[type="text"],
.container input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.container input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 3px;
cursor: pointer;
}
.container input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>Login</h2>
<form action="">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Login">
</form>
</div>
</body>
</html>
```
你可以将以上代码保存到一个名为 "login.html" 的文件中,并在浏览器中打开该文件,即可看到登录页面。这个页面包括了用户名、密码和登录按钮。