<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
overflow: hidden;
background-image: linear-gradient(to top, #9890e3 0%,#b1f4cf 100%);
}
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
@keyframes move {
0% {
top: 700px;
left: 0;
}
100% {
top: 700px;
left: 750px;
}
}
@keyframes run {
0% {
top: 0;
left: 0;
}
100% {
top: 0;
left: -1600px;
}
}
.bear {
position: relative;
bottom: 0;
overflow: hidden;
width: 200px;
height: 100px;
background-color: skyblue;
animation: move 5s linear forwards;
}
.bear img {
position: absolute;
animation: run .8s steps(8) infinite;
z-index: 999999;
}
.mon {
height: 700px;
animation: mon .5s ease 0s 1 forwards;
}
.mon .bg1 {
position: absolute;
height: 300px;
width: 3840px;
left: 0;
bottom: -12px;
z-index: 2;
background: url(../css动画/images/bg1.png) repeat-x;
animation: bg 50s linear infinite;
}
/* .mon .bg2 {
position: absolute;
width: 400px;
height: 3840px;
left: 0;
bottom: -12px;
z-index: 55;
background: url(../css动画/images/bg2.png) repeat-x;
animation: bg 50s linear infinite;
} */
.login {
position: relative;
top: -750px;
left: 0;
width: 400px;
height: 300px;
background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
border: 1px solid black;
margin: 0 auto;
padding: 20px 50px;
border-radius: 30px;
text-align: center;
}
.login h1 {
color: white; /* 拼错单词 while 这个单词是错的 */
}
.login .input {
margin-top: 50px;
}
.login .box .input {
margin-top: 20px;
}
.login .box .input input {
outline: none;
border: 0;
padding: 10px 10px;
background-color: #00000000;
color: white;
}
.login a .loginButton {
display: inline-block;
margin-top: 30px;
width: 200px;
height: 45px;
color: #333333;
border: 0;
border-radius: 20px;
line-height: 45px;
cursor: pointer;
background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);
text-align: center;
}
.input {
position: relative;
}
.input img {
width: 28px;
position: absolute;
top: 3px;
right: 92px;
}
@keyframes mon {
0% {
transform: scale(1.5);
}
100% {
transform: scale(1);
}
}
@keyframes bg {
0% {
background-position: 0 0;
}
100% {
background-position: -3840px 0;
}
}
</style>
</head>
<body>
<div class="bear">
<img src="../css动画/images/bear.png" alt="">
</div>
<div class="mon">
<div class="bg1"></div>
</div>
<div class="login">
<h1>Welcome</h1>
<div class="box">
<div class="input">
<input type="text" placeholder="请输入用户名">
</div>
<div class="input">
<img src="./images/close.png" alt="" id="eye">
<input type="password" placeholder="请输入密码" id="pwd">
</div>
<a href="#"><span class="loginButton">登陆</span></a>
</div>
</div>
<script>
// 1.获取元素
var eye = document.getElementById('eye');
var pwd = document.getElementById('pwd');
//2.注册事件
var flag = 0;
eye.onclick = function() {
if(flag == 0) {
pwd.type = 'text';
eye.src = './images/close.png';
flag = 1;
} else {
pwd.type = 'password';
eye.src = './images/open.png';
flag = 0;
}
}
</script>
</body>
</html>