用html css js 写一个登陆界面其中有用户名 密码 确定密码 手机号 验证码
时间: 2024-03-01 21:51:24 浏览: 54
好的,我可以给你提供一份简单的代码,但由于我无法直接在这里显示HTML、CSS和JavaScript代码,所以我将会提供代码的文本形式。你可以将这些代码复制到相应的文件中,然后在浏览器中打开该文件来查看效果。
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<link rel="stylesheet" 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>
<div class="user-box">
<input type="password" name="confirm-password" required="">
<label>Confirm Password</label>
</div>
<div class="user-box">
<input type="tel" name="phone" required="">
<label>Phone</label>
</div>
<div class="user-box">
<input type="text" name="verification-code" required="">
<label>Verification Code</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Submit
</a>
</form>
</div>
</body>
</html>
```
CSS代码:
```
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Open Sans', sans-serif;
}
body {
background: #f2f2f2;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.login-box {
background: #fff;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}
.login-box h2 {
font-weight: 600;
color: #555;
margin-bottom: 30px;
}
.user-box {
position: relative;
}
.user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #555;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #555;
outline: none;
background: transparent;
}
.user-box label {
position: absolute;
top: 0;
left: 0;
color: #555;
font-size: 16px;
padding: 10px 0;
pointer-events: none;
transition: 0.5s;
}
.user-box input:focus ~ label,
.user-box input:valid ~ label {
top: -20px;
left: 0;
color: #00bcd4;
font-size: 12px;
}
a {
display: inline-block;
background: #00bcd4;
color: #fff;
padding: 8px 30px;
border-radius: 30px;
text-decoration: none;
font-size: 16px;
margin-top: 20px;
position: relative;
overflow: hidden;
transition: 0.5s;
}
a:hover {
background: transparent;
color: #00bcd4;
}
a span {
position: absolute;
display: block;
}
a span:nth-child(1) {
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #00bcd4);
animation: animate1 1s linear infinite;
}
@keyframes animate1 {
from {
left: -100%;
}
to {
left: 100%;
}
}
a span:nth-child(2) {
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #00bcd4);
animation: animate2 1s linear infinite;
animation-delay: 0.25s;
}
@keyframes animate2 {
from {
top: -100%;
}
to {
top: 100%;
}
}
a span:nth-child(3) {
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #00bcd4);
animation: animate3 1s linear infinite;
animation-delay: 0.5s;
}
@keyframes animate3 {
from {
right: -100%;
}
to {
right: 100%;
}
}
a span:nth-child(4) {
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #00bcd4);
animation: animate4 1s linear infinite;
animation-delay: 0.75s;
}
@keyframes animate4 {
from {
bottom: -100%;
}
to {
bottom: 100%;
}
}
```
JavaScript代码:
```
// 这里可以写一些验证逻辑
```
上面的代码给出了一个基本的登录表单,其中包含用户名、密码、确认密码、手机号码和验证码等字段。其中,CSS代码使用了一些动画效果,使得登录按钮在鼠标悬停时会显示出边框,给用户一些视觉反馈。需要注意的是,这份代码只是一个示例,你可以根据自己的需求进行修改和定制。
阅读全文