Login page (ex1)


Login page (Form Wave)

1. Video

https://drive.google.com/file/d/1pNgJOeD_Qrjh6UCKGMM6Go3iPvI1ThI9/view?usp=sharing

ezgif.com-gif-maker

2. HTML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Login</title>
</head>

<body>
<div class="container">
<h1 class="text">Please Login</h1>
<form>

<div class="form-control">
<input type="text" required>
<label>Email</label>
</div>

<div class="form-control">
<input type="password" required>
<label>Password</label>
</div>

<button class="btn">Login</button>

<p class="text">Don't have an account? <a href="#">Register</a> </p>
</form>
</div>
<script src="script.js"></script>
</body>

</html>

3. CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');

* {
box-sizing: border-box;
}

body {
/* background-color: steelblue; */
background-image: url("src/hotels.jpg");
background-repeat: no-repeat;
/* color: #fff; */
font-family: 'Muli', sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
margin: 0;
background-size: cover;
background-position: bottom center;
}

.container {
background-color: rgba(0, 0, 0, 0.4);
padding: 20px 40px;
border-radius: 5px;
}

.container h1 {
text-align: center;
margin-bottom: 30px;
}

.container a {
text-decoration: none;
color: lightblue;
}

.btn {
cursor: pointer;
display: inline-block;
width: 100%;
background: lightblue;
padding: 15px;
font-family: inherit;
font-size: 16px;
border: 0;
border-radius: 5px;
}

.btn:focus {
outline: 0;
}

.btn:active {
transform: scale(0.98);
}

.text {
color: rgb(255, 255, 255);
margin-top: 30px;
}

.form-control {
position: relative;
margin: 20px 0 40px;
width: 300px;
}

.form-control input {

background-color: transparent;
border: 0;
border-bottom: 2px #fff solid;
display: block;
width: 100%;
padding: 15px 0;
font-size: 18px;
color: #fff;
}

.form-control input:focus,
.form-control input:valid {
outline: 0;
border-bottom-color: lightblue;
}

.form-control label {
color: rgb(255, 255, 255);
position: absolute;
top: 15px;
left: 0;
pointer-events: none;
}

.form-control label span {
display: inline-block;
font-size: 18px;
min-width: 5px;
transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.form-control input:focus+label span,
.form-control input:valid+label span {
color: lightblue;
transform: translateY(-30px);
}

4. JavaScript

1
2
3
4
5
6
7
8
const labels = document.querySelectorAll('.form-control label')

labels.forEach(label => {
label.innerHTML = label.innerText
.split('')
.map((letter, idx) => `<span style="transition-delay:${idx * 50}ms">${letter}</span>`)
.join('')
})

5.src

image-20220605183939453


Author: Liang Junyi
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Liang Junyi !
  TOC