用html+Css写一个简单的登录界面
时间: 2023-05-12 09:06:07 浏览: 69
好的,以下是一个简单的登录界面的 HTML 和 CSS 代码:
HTML 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h2>Login Here</h2>
<form>
<p>Username</p>
<input type="text" name="username" placeholder="Enter Username">
<p>Password</p>
<input type="password" name="password" placeholder="Enter Password">
<input type="submit" name="submit" value="Login">
<a href="#">Forgot Password</a>
</form>
</div>
</body>
</html>
```
CSS 代码:
```
body {
margin: 0;
padding: 0;
background: #f2f2f2;
}
.login-box {
width: 320px;
height: 420px;
background: #fff;
color: #000;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
box-sizing: border-box;
padding: 70px 30px;
}
h2 {
margin: 0;
padding: 0 0 20px;
text-align: center;
font-size: 22px;
}
.login-box p {
margin: 0;
padding: 0;
font-weight: bold;
}
.login-box input {
width: 100%;
margin-bottom: 20px;
}
.login-box input[type="text"], input[type="password"] {
border: none;
border-bottom: 1px solid #000;
background: transparent;
outline: none;
height: 40px;
color: #000;
font-size: 16px;
}
.login-box input[type="submit"] {
border: none;
outline: none;
height: 40px;
background: #000;
color: #fff;
font-size: 18px;
border-radius: 20px;
}
.login-box input[type="submit"]:hover {
cursor: pointer;
background: #ffc107;
color: #000;
}
.login-box a {
text-decoration: none;
font-size: 14px;
color: #000;
}
.login-box a:hover {
color: #ffc107;
}
```
希望这个代码能够帮到你!