forked from jolaleye/cssfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput-outline2.vue
81 lines (68 loc) · 1.08 KB
/
input-outline2.vue
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
<template>
<div>
<input type="text" placeholder="Input Outline">
<span class="bottom"></span>
<span class="right"></span>
<span class="top"></span>
<span class="left"></span>
</div>
</template>
<style scoped>
div {
position: relative;
}
input {
width: 6.5em;
color: white;
font-size: inherit;
font-family: inherit;
background-color: hsl(236, 32%, 26%);
padding: 0.35em 0.45em;
border: 1px solid transparent;
transition: background-color 0.3s ease-in-out;
}
input:focus {
outline: none;
}
input::placeholder {
color: hsla(0, 0%, 100%, 0.6);
}
span {
position: absolute;
background-color: #fc2f70;
transform-origin: center;
transition: transform 0.5s ease;
}
.bottom,
.top {
height: 1px;
left: 0;
right: 0;
transform: scaleX(0);
}
.left,
.right {
width: 1px;
top: 0;
bottom: 0;
transform: scaleY(0);
}
.top {
top: 0;
}
.bottom {
bottom: 0;
}
.left {
left: 0;
}
.right {
right: 0;
}
input:focus ~ .top, input:focus ~ .bottom {
transform: scaleX(1);
}
input:focus ~ .left, input:focus ~ .right {
transform: scaleY(1);
}
</style>