본문 바로가기

퍼블리싱/HTML | CSS | Javascript

HTML,CSS를 이용한 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
<article class="htmleaf-container">
        <section class="wrapper cl">
            <!--Effect: Bottom to Top -->
            <div class="pic">
                <img src="https://unsplash.it/300/200?image=931" class="pic-image" alt="Pic">
                <span class="pic-caption bottom-to-top">
          <h1 class="pic-title">Bottom to Top</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Top to Bottom -->
            <div class="pic">
                <img src="https://unsplash.it/300/200?image=902" class="pic-image" alt="Pic">
                <span class="pic-caption top-to-bottom">
          <h1 class="pic-title">Top to Bottom</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Left to Right -->
            <div class="pic">
                <img src="https://unsplash.it/300/200?image=903" class="pic-image" alt="Pic">
                <span class="pic-caption left-to-right">
          <h1 class="pic-title">Left to Right</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Right to Left -->
            <div class="pic">
                <img src="https://unsplash.it/300/200?image=904" class="pic-image" alt="Pic">
                <span class="pic-caption right-to-left">
          <h1 class="pic-title">Right to Left</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Rotate More -->
            <div class="pic">
                <img src="https://unsplash.it/300/200?image=910" class="pic-image" alt="Pic">
                <span class="pic-caption rotate-in">
          <h1 class="pic-title">Rotate In</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Rotate LESS -->
            <div class="pic">
                <img src="https://unsplash.it/300/200?image=912" class="pic-image" alt="Pic">
                <span class="pic-caption rotate-out">
          <h1 class="pic-title">Rotate Out</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Open Up -->
            <div class="pic pic-3d">
                <img src="https://unsplash.it/300/200?image=913" class="pic-image" alt="Pic">
                <span class="pic-caption open-up">
          <h1 class="pic-title">Open Up</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Open Down -->
            <div class="pic pic-3d">
                <img src="https://unsplash.it/300/200?image=914" class="pic-image" alt="Pic">
                <span class="pic-caption open-down">
          <h1 class="pic-title">Open Down</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Open Left -->
            <div class="pic pic-3d">
                <img src="https://unsplash.it/300/200?image=905" class="pic-image" alt="Pic">
                <span class="pic-caption open-left">
          <h1 class="pic-title">Open Left</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Open Right -->
            <div class="pic pic-3d">
                <img src="https://unsplash.it/300/200?image=918" class="pic-image" alt="Pic">
                <span class="pic-caption open-right">
          <h1 class="pic-title">Open Right</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Come Left -->
            <div class="pic pic-3d">
                <img src="https://unsplash.it/300/200?image=919" class="pic-image" alt="Pic">
                <span class="pic-caption come-left">
          <h1 class="pic-title">Come Left</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
            <!--Effect: Come Right -->
            <div class="pic pic-3d">
                <img src="https://unsplash.it/300/200?image=932" class="pic-image" alt="Pic">
                <span class="pic-caption come-right">
          <h1 class="pic-title">Come Right</h1>
          <p>Hi, this is a simple example =D</p>
      </span>
            </div>
        </section>
       
      
    </article>
cs

 

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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
body {
    line-height: 1
}
 
ol,
ul {
    list-style: none
}
 
blockquote,
{
    quotes: none
}
 
blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none
}
 
table {
    border-collapse: collapse;
    border-spacing: 0
}
html {height:100%;width:100%;}
body {
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif, 'trebuhet ms', HelveticaNeue, arial;
    height: 100%;
    line-height: 20px
}
 
{
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -o-box-sizing: border-box;
    -ms-box-sizing: border-box;
    box-sizing: border-box
}
 
{
    line-height: 2.0em
}
 
h1 {
    font-size: 3.0em;
    line-height: 40px
}
 
{
    text-decoration: none;
    color: rgba(74, 92, 110, 0.92)
}
 
a:hover {
    color: #fff
}
 
img {
    max-width: 100%
}
 
.pull-right {
    float: right
}
 
.pull-left {
    float: left
}
 
header {
    padding: 30px 20px;
    background: rgba(64, 82, 100, 0.92);
    color: #ffffff;
    margin-bottom: 20px
}
 
.btn-download {
    background: rgba(24, 42, 60, 0.92);
    color: rgba(124, 142, 160, 0.92);
    padding: 20px 50px;
    display: inline-block;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -o-border-radius: 5px;
    -ms-border-radius: 5px;
    border-radius: 5px
}
 
.btn-download:hover {
    background: rgba(94, 112, 130, 0.92)
}
 
.wrapper {
    max-width: 1000px;
    margin: 0 auto
}
 
.wrapper:before,
.wrapper:after {
    content: '';
    display: table;
    clear: both
}
 
footer {
    margin-top: 30px;
    background: rgba(24, 42, 60, 0.92);
    color: rgba(124, 142, 160, 0.92);
    padding: 20px 0;
    text-align: left;
    font-size: 0.9em
}
 
@keyframes anima {
    from {
        margin-top: -50px;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
        filter: alpha(opacity=0);
        -moz-opacity: 0;
        -khtml-opacity: 0;
        opacity: 0
    }
    to {
        margin: auto;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
        filter: alpha(opacity=100);
        -moz-opacity: 1;
        -khtml-opacity: 1;
        opacity: 1
    }
}
 
@-webkit-keyframes anima {
    from {
        margin-left: -20px;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
        filter: alpha(opacity=0);
        -moz-opacity: 0;
        -khtml-opacity: 0;
        opacity: 0
    }
    to {
        margin-left: 10px;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
        filter: alpha(opacity=100);
        -moz-opacity: 1;
        -khtml-opacity: 1;
        opacity: 1
    }
}
 
 
 
 
.pic {
    max-width: 300px;
    max-height: 200px;
    position: relative;
    overflow: hidden;
    margin: 10px;
    display: inline-block;
    -webkit-animation: anima 2s;
    -moz-animation: anima 2s;
    -o-animation: anima 2s;
    -ms-animation: anima 2s;
    animation: anima 2s;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -o-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    backface-visibility: hidden;
 
 
}
 
.pic-3d {
    -webkit-perspective: 500;
    -moz-perspective: 500;
    -o-perspective: 500;
    -ms-perspective: 500;
    perspective: 500;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    -ms-transform-style: preserve-3d;
    transform-style: preserve-3d
}
 
.pic-caption {
    cursor: default;
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.92);
    padding: 10px;
    text-align: center;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
    filter: alpha(opacity=0);
    -moz-opacity: 0;
    -khtml-opacity: 0;
    opacity: 0
}
 
.pic-image {
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -o-transform: scale(1.1);
    -ms-transform: scale(1.1);
    transform: scale(1.1)
}
 
.pic:hover .pic-image {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -o-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1)
}
 
.pic-title {
    font-size: 1.8em
}
 
a,
a:hover,
.pic .pic-image,
.pic-caption,
.pic:hover .pic-caption,
.pic:hover img {
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    -ms-transition: all 0.5s ease;
    transition: all 0.5s ease
}
 
.pic:hover .bottom-to-top,
.pic:hover .top-to-bottom,
.pic:hover .left-to-right,
.pic:hover .right-to-left,
.pic:hover .rotate-in,
.pic:hover .rotate-out,
.pic:hover .open-up,
.pic:hover .open-down,
.pic:hover .open-left,
.pic:hover .open-right,
.pic:hover .come-left,
.pic:hover .come-right {
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
    filter: alpha(opacity=100);
    -moz-opacity: 1;
    -khtml-opacity: 1;
    opacity: 1;
    -webkit-user-select: none;
    -moz-user-select: none;
    -o-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -moz-touch-callout: none;
    -o-touch-callout: none;
    -ms-touch-callout: none;
    touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -moz-tap-highlight-color: transparent;
    -o-tap-highlight-color: transparent;
    -ms-tap-highlight-color: transparent;
    tap-highlight-color: transparent
}
 
.bottom-to-top {
    top: 50%;
    left: 0
}
 
.pic:hover .bottom-to-top {
    top: 0;
    left: 0
}
 
.top-to-bottom {
    bottom: 50%;
    left: 0
}
 
.pic:hover .top-to-bottom {
    left: 0;
    bottom: 0
}
 
.left-to-right {
    top: 0;
    right: 50%
}
 
.pic:hover .left-to-right {
    right: 0;
    top: 0
}
 
.right-to-left {
    top: 0;
    left: 50%
}
 
.pic:hover .right-to-left {
    left: 0;
    top: 0
}
 
.rotate-in {
    -webkit-transform: rotate(90deg) scale(0.1);
    -moz-transform: rotate(90deg) scale(0.1);
    -o-transform: rotate(90deg) scale(0.1);
    -ms-transform: rotate(90deg) scale(0.1);
    transform: rotate(90deg) scale(0.1);
    top: 0;
    left: 0
}
 
.pic:hover .rotate-in {
    -webkit-transform: rotate(360deg) scale(1);
    -moz-transform: rotate(360deg) scale(1);
    -o-transform: rotate(360deg) scale(1);
    -ms-transform: rotate(360deg) scale(1);
    transform: rotate(360deg) scale(1)
}
 
.rotate-out {
    -webkit-transform: rotate(90deg) scale(3);
    -moz-transform: rotate(90deg) scale(3);
    -o-transform: rotate(90deg) scale(3);
    -ms-transform: rotate(90deg) scale(3);
    transform: rotate(90deg) scale(3);
    top: 0;
    left: 0
}
 
.pic:hover .rotate-out {
    -webkit-transform: rotate(360deg) scale(1);
    -moz-transform: rotate(360deg) scale(1);
    -o-transform: rotate(360deg) scale(1);
    -ms-transform: rotate(360deg) scale(1);
    transform: rotate(360deg) scale(1)
}
 
.open-down {
    -webkit-transform: rotateX(-180deg);
    -moz-transform: rotateX(-180deg);
    -o-transform: rotateX(-180deg);
    -ms-transform: rotateX(-180deg);
    transform: rotateX(-180deg);
    top: 0;
    left: 0
}
 
.pic:hover .open-down {
    -webkit-transform: rotateX(0);
    -moz-transform: rotateX(0);
    -o-transform: rotateX(0);
    -ms-transform: rotateX(0);
    transform: rotateX(0)
}
 
.open-up {
    -webkit-transform: rotateX(180deg);
    -moz-transform: rotateX(180deg);
    -o-transform: rotateX(180deg);
    -ms-transform: rotateX(180deg);
    transform: rotateX(180deg);
    top: 0;
    left: 0
}
 
.pic:hover .open-up {
    -webkit-transform: rotateX(0);
    -moz-transform: rotateX(0);
    -o-transform: rotateX(0);
    -ms-transform: rotateX(0);
    transform: rotateX(0)
}
 
.open-left {
    -webkit-transform: rotateY(180deg);
    -moz-transform: rotateY(180deg);
    -o-transform: rotateY(180deg);
    -ms-transform: rotateY(180deg);
    transform: rotateY(180deg);
    left: 0;
    top: 0
}
 
.pic:hover .open-left {
    -webkit-transform: rotateY(0deg);
    -moz-transform: rotateY(0deg);
    -o-transform: rotateY(0deg);
    -ms-transform: rotateY(0deg);
    transform: rotateY(0deg)
}
 
.open-right {
    -webkit-transform: rotateY(-180deg);
    -moz-transform: rotateY(-180deg);
    -o-transform: rotateY(-180deg);
    -ms-transform: rotateY(-180deg);
    transform: rotateY(-180deg);
    left: 0;
    top: 0
}
 
.pic:hover .open-right {
    -webkit-transform: rotateY(0deg);
    -moz-transform: rotateY(0deg);
    -o-transform: rotateY(0deg);
    -ms-transform: rotateY(0deg);
    transform: rotateY(0deg)
}
 
.come-left {
    -webkit-transform: rotateY(90deg) rotateX(90deg);
    -moz-transform: rotateY(90deg) rotateX(90deg);
    -o-transform: rotateY(90deg) rotateX(90deg);
    -ms-transform: rotateY(90deg) rotateX(90deg);
    transform: rotateY(90deg) rotateX(90deg);
    left: 0;
    top: 0
}
 
.pic:hover .come-left {
    -webkit-transform: rotateY(0) rotateX(0);
    -moz-transform: rotateY(0) rotateX(0);
    -o-transform: rotateY(0) rotateX(0);
    -ms-transform: rotateY(0) rotateX(0);
    transform: rotateY(0) rotateX(0)
}
 
.come-right {
    -webkit-transform: rotateY(-90deg) rotateX(-90deg);
    -moz-transform: rotateY(-90deg) rotateX(-90deg);
    -o-transform: rotateY(-90deg) rotateX(-90deg);
    -ms-transform: rotateY(-90deg) rotateX(-90deg);
    transform: rotateY(-90deg) rotateX(-90deg);
    left: 0;
    top: 0
}
 
.pic:hover .come-right {
    -webkit-transform: rotateY(0) rotateX(0);
    -moz-transform: rotateY(0) rotateX(0);
    -o-transform: rotateY(0) rotateX(0);
    -ms-transform: rotateY(0) rotateX(0);
    transform: rotateY(0) rotateX(0)
}
 
@media screen and (max-width: 560px) {
    .pic {
        max-width: 400px;
        max-height: 300px;
        display: block;
        -webkit-animation: none;
        -moz-animation: none;
        -o-animation: none;
        -ms-animation: none;
        animation: none;
        margin: 10px auto
    }
}
 
cs

아이고 길다 ....

728x90

'퍼블리싱 > HTML | CSS | Javascript' 카테고리의 다른 글

display: table  (0) 2017.04.02
(링크) 버튼 여러가지 모음  (0) 2017.04.02
텍스트 드래그 스타일링  (0) 2017.04.02
flexbox  (0) 2017.04.02
배경'만' 투명도 조절  (0) 2017.04.02