给我用html写一个登录页面
时间: 2023-03-15 12:15:42 浏览: 62
我可以给你一个示例,你可以根据你的需求进行更改:<html>
<head>
<title>登录页面</title>
</head>
<body>
<h1>登录</h1>
<form action="/action_page.php">
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
<input type="submit" value="提交">
</form>
</body>
</html>
相关问题
给我用HTML和CSS写一个登录页面
### 回答1:
我可以写出一个简单的登录页面,你可以用HTML和CSS:<html>
<head>
<title>登录页面</title>
</head>
<body>
<form action="your-server-side-code.php" method="post">
<input type="text" placeholder="用户名" name="username" />
<input type="password" placeholder="密码" name="password" />
<input type="submit" value="登录" />
</form>
</body>
</html>
### 回答2:
当然可以,以下是一个简单的登录页面的HTML和CSS代码示例:
HTML代码:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录页面</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-container">
<h1>用户登录</h1>
<form>
<label for="username">用户名:</label>
<input type="text" id="username" name="username"><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password"><br>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
CSS代码(style.css):
```css
.login-container {
width: 300px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
h1 {
text-align: center;
font-size: 24px;
}
form {
margin-top: 20px;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 5px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 10px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #337ab7;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
}
```
以上代码创建了一个简单的登录页面,包含一个标题、用户名和密码的输入框以及一个登录按钮。使用HTML编写页面结构,CSS样式用来美化页面布局和元素样式。
### 回答3:
好的,以下是一个使用HTML和CSS编写的简单登录页面:
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<form>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
CSS代码(保存为style.css):
```css
.container {
width: 300px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom: 10px;
}
input[type="text"],
input[type="password"] {
padding: 5px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 3px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
```
以上代码实现了一个基本的登录页面,包括用户名输入框、密码输入框和登录按钮。页面使用了CSS进行简单的样式设置,如容器的宽度、边框、圆角等。输入框和按钮的样式采用了基本的边框和背景色设置,并在鼠标悬停时变化颜色。
用html给我写一个登录页面
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h1>Login Page</h1>
<form action="#" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Login">
</form>
</body>
</html>