forked from tachyons-css/tachyons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_hovers.css
160 lines (128 loc) · 2.85 KB
/
_hovers.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
HOVER EFFECTS
Docs: http:https://tachyons.io/docs/themes/hovers/
- Dim
- Glow
- Hide Child
- Underline text
- Grow
- Pointer
- Shadow
*/
/*
Dim element on hover by adding the dim class.
*/
.dim {
opacity: 1;
transition: opacity .15s ease-in;
}
.dim:hover,
.dim:focus {
opacity: .5;
transition: opacity .15s ease-in;
}
.dim:active {
opacity: .8; transition: opacity .15s ease-out;
}
/*
Animate opacity to 100% on hover by adding the glow class.
*/
.glow {
transition: opacity .15s ease-in;
}
.glow:hover,
.glow:focus {
opacity: 1;
transition: opacity .15s ease-in;
}
/*
Hide child & reveal on hover:
Put the hide-child class on a parent element and any nested element with the
child class will be hidden and displayed on hover or focus.
<div class="hide-child">
<div class="child"> Hidden until hover or focus </div>
<div class="child"> Hidden until hover or focus </div>
<div class="child"> Hidden until hover or focus </div>
<div class="child"> Hidden until hover or focus </div>
</div>
*/
.hide-child .child {
opacity: 0;
transition: opacity .15s ease-in;
}
.hide-child:hover .child,
.hide-child:focus .child,
.hide-child:active .child {
opacity: 1;
transition: opacity .15s ease-in;
}
.underline-hover:hover,
.underline-hover:focus {
text-decoration: underline;
}
/* Can combine this with overflow-hidden to make background images grow on hover
* even if you are using background-size: cover */
.grow {
-moz-osx-font-smoothing: grayscale;
backface-visibility: hidden;
transform: translateZ(0);
transition: transform 0.25s ease-out;
}
.grow:hover,
.grow:focus {
transform: scale(1.05);
}
.grow:active {
transform: scale(.90);
}
.grow-large {
-moz-osx-font-smoothing: grayscale;
backface-visibility: hidden;
transform: translateZ(0);
transition: transform .25s ease-in-out;
}
.grow-large:hover,
.grow-large:focus {
transform: scale(1.2);
}
.grow-large:active {
transform: scale(.95);
}
/* Add pointer on hover */
.pointer:hover {
cursor: pointer;
}
/*
Add shadow on hover.
Performant box-shadow animation pattern from
http:https://tobiasahlin.com/blog/how-to-animate-box-shadow/
*/
.shadow-hover {
cursor: pointer;
position: relative;
transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.shadow-hover::after {
content: '';
box-shadow: 0px 0px 16px 2px rgba( 0, 0, 0, .2 );
border-radius: inherit;
opacity: 0;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
transition: opacity 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.shadow-hover:hover::after,
.shadow-hover:focus::after {
opacity: 1;
}
/* Combine with classes in skins and skins-pseudo for
* many different transition possibilities. */
.bg-animate,
.bg-animate:hover,
.bg-animate:focus {
transition: background-color .15s ease-in-out;
}