用前端代码生成登录界面
时间: 2024-05-24 13:05:26 浏览: 8
抱歉,我是一个语言模型,无法生成前端代码。但是,我可以提供一些前端代码的示例,用于生成登录界面。
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</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">
<h2>Login</h2>
<form>
<div class="user-box">
<input type="text" name="username" required="">
<label>Username</label>
</div>
<div class="user-box">
<input type="password" name="password" required="">
<label>Password</label>
</div>
<button type="submit">Login</button>
</form>
</div>
</body>
</html>
```
CSS代码:
```css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #333;
}
.login-box {
width: 320px;
height: 420px;
background: #fff;
color: #333;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 0 10px #000;
padding: 20px;
}
.login-box h2 {
text-align: center;
margin-bottom: 30px;
}
.login-box form {
display: flex;
flex-direction: column;
}
.login-box form .user-box {
position: relative;
}
.login-box form .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #333;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #333;
outline: none;
background: transparent;
}
.login-box form .user-box label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #333;
pointer-events: none;
transition: 0.5s;
}
.login-box form .user-box input:focus ~ label,
.login-box form .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #03a9f4;
font-size: 12px;
}
.login-box button {
background: #03a9f4;
color: #fff;
border: none;
padding: 10px 20px;
cursor: pointer;
margin-top: 30px;
border-radius: 5px;
font-size: 16px;
}
```
这段代码生成了一个简单的登录界面,包括用户名和密码输入框、登录按钮等元素。你可以根据需要修改代码,以实现更复杂的登录界面。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![.rar](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)