"CSS Button Hover Effects"
Bootstrap 4.1.1 Snippet by ttorrez

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
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div>
<button type="button" class="btn btn-primary slideup">Primary</button>
<button type="button" class="btn btn-secondary slidedown">Secondary</button>
<button type="button" class="btn btn-success slideright">Success</button>
<button type="button" class="btn btn-danger slideleft">Danger</button>
<button type="button" class="btn btn-warning slidetopright">Warning</button>
<button type="button" class="btn btn-info slidetopleft">Info</button>
<button type="button" class="btn btn-light slidebottomright">Light</button>
<button type="button" class="btn btn-dark slidebottomleft">Dark</button>
</div>
<div>
<br />
<button type="button" class="btn btn-outline-primary slideup">Primary</button>
<button type="button" class="btn btn-outline-secondary slidedown">Secondary</button>
<button type="button" class="btn btn-outline-success slideright">Success</button>
<button type="button" class="btn btn-outline-danger slideleft">Danger</button>
<button type="button" class="btn btn-outline-warning slidetopright">Warning</button>
<button type="button" class="btn btn-outline-info slidetopleft">Info</button>
<button type="button" class="btn btn-outline-light slidebottomright">Light</button>
<button type="button" class="btn btn-outline-dark slidebottomleft">Dark</button>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
.btn{
background: transparent;
position: relative;
overflow: hidden;
transition: all .5s;
}
/* //// Default effect: Slide from Top //// */
.btn:before,
.btn:after{
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
height: 100%;
z-index: -1;
transition: all .5s;
}
.btn:hover{
color: white;
}
.btn:hover:after{
transform: translate3D(0,0,0);
transition: all .5s;
}
.btn-primary:before{
background: #007bff; /* button default background color */
}
.btn-primary:after{
background: #0000005a;
}
.btn-primary:hover{
background: #025ec1;
}
.btn-secondary:before{
background: #6c757d;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: