用html和css实现校园网站登录界面
时间: 2024-03-17 13:43:22 浏览: 21
好的,我可以为您提供一份简单的校园网站登录界面的HTML和CSS代码,如下:
HTML代码:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>校园网站登录界面</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-box">
<h2>校园网站登录</h2>
<form>
<div class="user-box">
<input type="text" name="" required="">
<label>用户名</label>
</div>
<div class="user-box">
<input type="password" name="" required="">
<label>密码</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
登录
</a>
</form>
</div>
</body>
</html>
```
CSS代码:
```css
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
background: #1abc9c;
font-family: sans-serif;
}
.login-box{
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
color: #fff;
}
.login-box h2{
text-align: center;
margin-bottom: 20px;
}
.login-box form{
display: flex;
flex-direction: column;
justify-content: center;
}
.user-box{
position: relative;
margin-bottom: 20px;
}
.user-box input{
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #fff;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #fff;
outline: none;
background: transparent;
}
.user-box label{
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #fff;
pointer-events: none;
transition: .5s;
}
.user-box input:focus ~ label,
.user-box input:valid ~ label{
top: -20px;
left: 0;
color: #03a9f4;
font-size: 12px;
}
a{
display: inline-block;
background: transparent;
border: 2px solid #fff;
padding: 14px 80px;
color: #fff;
font-size: 16px;
text-transform: uppercase;
letter-spacing: 2px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: .5s;
}
a:hover{
background: #fff;
color: #1abc9c;
}
a span{
position: absolute;
display: block;
}
a span:nth-child(1){
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg,transparent,#fff);
}
a:hover span:nth-child(1){
left: 100%;
transition: 1s;
}
a span:nth-child(2){
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg,transparent,#fff);
}
a:hover span:nth-child(2){
top: 100%;
transition: .5s;
}
a span:nth-child(3){
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg,transparent,#fff);
}
a:hover span:nth-child(3){
right: 100%;
transition: .5s;
}
a span:nth-child(4){
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg,transparent,#fff);
}
a:hover span:nth-child(4){
bottom: 100%;
transition: .5s;
}
```
您可以将上述代码复制到您的HTML和CSS文件中,并进行一些微调,以适应您的网站需求。