HTML制作登陆界面
时间: 2024-01-26 18:11:19 浏览: 85
好的,制作登陆界面需要用到HTML、CSS和JavaScript。下面是一个简单的登陆界面的HTML代码:
```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><br>
<a href="#">Don't have an account? Sign up</a>
</form>
</div>
</body>
</html>
```
其中,`<link>` 标签用于引入样式表,样式表的代码如下:
```css
body {
margin: 0;
padding: 0;
background: #f1f1f1;
}
.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;
}
```
这个样式表定义了登陆界面的样式,包括背景颜色、登陆框的大小和位置、字体大小和颜色等。
阅读全文