-
Notifications
You must be signed in to change notification settings - Fork 0
/
hover.html
155 lines (123 loc) · 2.94 KB
/
hover.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
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
<!DOCTYPE html>
<html>
<head>
<style>
/*This is where I'm making all the divs have a certain width and height
*/
div {
margin: 20px;
width: 200px;
height: 200px;
border: dotted;
}
/*An example of changing an background image on hover*/
#molly {
width: 200px;
height: 200px;
background-image: url("https://cdn.cnn.com/cnnnext/dam/assets/170212194302-beyonce-performs-grammy-exlarge-169.jpg");
background-size: cover;
background-position: center;
transition: ease-in-out 1s;
}
#molly:hover {
transition: ease-in-out 1s;
background-image: url("https://media1.giphy.com/media/EwwgX5Wloqabu/source.gif")
}
/*An example of changing background color on hover*/
#charlie {
background-color: lightblue;
transition: ease-in-out 1s;
}
#charlie:hover {
transition: ease-in-out 1s;
background-color: orange;
}
/* An example of adding a bouncy animation
*/
#sloan {
color: red;
font-size: 60px;
background-image: url("https://heattransfervinyl4u.com/image/cache/Pattern/Checkerboard%20main1-800x800.jpg");
background-size: contain;
transition: ease .5s;
}
#sloan:hover {
transform: rotate(1000deg);
}
#tom {
background-color: purple;
transition: ease 1s;
}
#tom:hover {
transition: ease-in-out 1s;
animation-name: dance;
animation-duration: 1s;
animation-iteration-count: infinite;
transition: ease-in-out 1s;
background-color: orange;
}
/*This is an animation, the one that's referred to as "dance" above*/
@keyframes dance {
0% {
width: 200px;
}
50% {
width: 200px;
border-radius: 50%;
}
100% {
width: 300px;
}
}
#bouncy {
width: 80px;
height: 80px;
background-color: orange;
border: none;
border-radius: 50%;
font-size: 20px;
text-align: center;
position: relative;
left: 0%;
transition:1s;
animation-duration: 1s;
animation-iteration-count: infinite;
transition: ease-in-out 1s;
}
#bouncy:hover {
transition:ease 1s;
animation-name: bounce;
}
@keyframes bounce {
0% {
top: 0%
}
50% {
top: 50%
}
100% {
top: -20%
}
}
</style>
</head>
<body>
<div id="molly">
changing background image
</div>
<div id="charlie">
changing color on hover
</div>
<div id="sloan">
spin!
</div>
<div style="color:white;" id="tom">
animation example
</div>
<div id="katie">
<div id="bouncy">
<br>
Bounce!</div>
</div>
</body>
</html>