请你用代码编写仿造知乎的登录界面
时间: 2023-06-07 20:07:41 浏览: 57
抱歉,我无法编写代码,但我可以向您提供知乎登录界面的 HTML 和 CSS 代码示例。请参考以下代码:
HTML 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>知乎登录</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h1>知乎登录</h1>
<form>
<label for="username">用户名</label>
<input type="text" id="username" name="username" placeholder="请输入用户名">
<label for="password">密码</label>
<input type="password" id="password" name="password" placeholder="请输入密码">
<label class="checkbox-container">
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
记住我
</label>
<button type="submit">登录</button>
<div class="other-options">
<a href="">手机验证码登录</a> |
<a href="">忘记密码</a>
</div>
</form>
</div>
</body>
</html>
```
CSS 代码:
```
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #f2f2f2;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.login-box {
background-color: #fff;
border-radius: 8px;
box-shadow: 0px 15px 20px rgba(0, 0, 0, 0.1);
margin: 100px auto;
max-width: 500px;
padding: 30px;
}
h1 {
color: #333;
font-size: 28px;
margin-bottom: 30px;
text-align: center;
}
form {
display: flex;
flex-direction: column;
}
label {
color: #666;
display: block;
font-size: 16px;
margin-bottom: 6px;
}
input[type="text"],
input[type="password"] {
border: none;
border-radius: 4px;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
font-size: 16px;
margin-bottom: 20px;
padding: 10px;
}
input[type="text"]:focus,
input[type="password"]:focus {
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2);
outline: none;
}
.checkbox-container {
display: inline-block;
position: relative;
padding-left: 30px;
margin-bottom: 20px;
cursor: pointer;
font-size: 16px;
user-select: none;
}
.checkbox-container input {
position: absolute;
opacity: 0;
cursor: pointer;
}
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 20px;
width: 20px;
background-color: #eee;
}
.checkbox-container:hover input ~ .checkmark {
background-color: #ccc;
}
.checkbox-container input:checked ~ .checkmark {
background-color: #2196F3;
}
.checkmark:after {
content: "";
position: absolute;
display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
display: block;
}
.checkbox-container .checkmark:after {
left: 7px;
top: 3px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 3px 3px 0;
transform: rotate(45deg);
}
button[type="submit"] {
background-color: #0084ff;
border: none;
border-radius: 4px;
color: #fff;
cursor: pointer;
font-size: 16px;
margin-top: 20px;
padding: 10px;
transition: background-color 0.2s ease;
}
button[type="submit"]:hover {
background-color: #0071e6;
}
.other-options {
color: #999;
font-size: 14px;
margin-top: 20px;
text-align: center;
}
.other-options a {
color: #999;
text-decoration: none;
}
.other-options a:hover {
color: #666;
}
```