web登录界面设计代码
时间: 2023-12-07 20:03:24 浏览: 29
以下是一个简单的Web登录界面设计代码示例:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h1>Login</h1>
<form>
<label for="username">Username</label>
<input type="text" id="username" name="username" placeholder="Enter username">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Enter password">
<button type="submit" class="btn">Login</button>
</form>
</div>
</body>
</html>
```
CSS代码:
```
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: sans-serif;
background-color: #f1f1f1;
}
.login-box {
width: 300px;
margin: 50px auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
h1 {
text-align: center;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
font-weight: bold;
margin-bottom: 5px;
}
input[type="text"], input[type="password"] {
padding: 10px;
margin-bottom: 20px;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}
button[type="submit"] {
padding: 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
cursor: pointer;
}
button[type="submit"]:hover {
background-color: #3e8e41;
}
```
这是一个简单的登录界面,包含用户名和密码输入框以及登录按钮。你可以根据需要进行更改和自定义。