jsp设计精美的登录页面,要求包含css
时间: 2023-08-22 14:33:30 浏览: 48
好的,我可以给您提供一份简单的代码,实现一个设计精美的登录页面,并包含 CSS 样式。
HTML 代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<link rel="stylesheet" href="login.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: linear-gradient(to bottom, #00b4db, #0083b0);
font-family: sans-serif;
}
.login-box{
width: 320px;
height: 420px;
background: #fff;
color: #000;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%,-50%);
box-shadow: 0 5px 15px rgba(0,0,0,.5);
padding: 70px 30px;
}
.login-box h2{
margin: 0;
padding: 0 0 20px;
text-align: center;
font-size: 22px;
}
.login-box .user-box{
position: relative;
}
.login-box .user-box input{
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #000;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #000;
outline: none;
background: transparent;
}
.login-box .user-box label{
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #000;
pointer-events: none;
transition: .5s;
}
.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label{
top: -20px;
left: 0;
color: #00b4db;
font-size: 12px;
}
.login-box form a{
position: relative;
display: inline-block;
padding: 10px 20px;
color: #fff;
font-size: 16px;
text-transform: uppercase;
letter-spacing: 2px;
background: linear-gradient(to right, #00b4db, #0083b0);
border: none;
cursor: pointer;
margin-top: 40px;
transition: .5s;
}
.login-box form a:hover{
background: #fff;
color: #000;
}
.login-box form a span{
position: absolute;
display: block;
}
.login-box form a span:nth-child(1){
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(to right, #00b4db, #0083b0);
animation: btn-anim1 1s linear infinite;
}
@keyframes btn-anim1 {
0%{
left: -100%;
}
50%,100%{
left: 100%;
}
}
.login-box form a span:nth-child(2){
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(to bottom, #00b4db, #0083b0);
animation: btn-anim2 1s linear infinite;
animation-delay: .25s;
}
@keyframes btn-anim2 {
0%{
top: -100%;
}
50%,100%{
top: 100%;
}
}
.login-box form a span:nth-child(3){
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(to left, #00b4db, #0083b0);
animation: btn-anim3 1s linear infinite;
animation-delay: .5s;
}
@keyframes btn-anim3 {
0%{
right: -100%;
}
50%,100%{
right: 100%;
}
}
.login-box form a span:nth-child(4){
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(to top, #00b4db, #0083b0);
animation: btn-anim4 1s linear infinite;
animation-delay: .75s;
}
@keyframes btn-anim4 {
0%{
bottom: -100%;
}
50%,100%{
bottom: 100%;
}
}
```
以上是一个简单的登录页面的代码,包含了一些 CSS 样式,可以根据您的需要进行修改和调整。