a(href='#').btn a.btn
View Compiled
@import url('https://fonts.googleapis.com/css?family=Noto+Sans');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: box;
display: flex;
box-pack: center;
justify-content: center;
box-align: center;
align-items: center;
width: 100%;
height: 100vh;
overflow: hidden;
font-family: 'Noto Sans', sans-serif;
}
a {
text-decoration: none;
}
.btn {
display: box;
position: relative;
width: 100px;
height: 100px;
background: linear-gradient(to bottom, hotpink 0%, tomato 100%);
box-shadow: 0 4px 4px rgba(0, 0, 0, .3);
border-radius: 50%;
line-height: 100px;
text-align: center;
text-decoration: none;
color: white;
}
.btn::before {
display: block;
position: absolute;
z-index: -1;
width: 100%;
height: 100%;
border-radius: 50%;
background: black;
opacity: 0;
content: '';
animation: pulse 1s infinite;
}
.btn:hover::before {
animation: none;
opacity: .4;
transform: scale(1.3);
}
.btn.is-clicked {
background: linear-gradient(to bottom, gray 0%, dimgray 100%);
}
.btn.is-clicked:before {
animation: blastOut 1s;
}
@keyframes pulse {
from {
transform: scale(1);
opacity: .4;
}
to {
transform: scale(1.3);
opacity: 0;
}
}
@keyframes blastOut {
from {
transform: scale(0.9);
opacity: .4;
}
to {
transform: scale(10);
opacity: 0;
}
}
$(function() {
$('.btn').click(function() {
$(this).toggleClass('is-clicked');
});
});
This Pen doesn't use any external CSS resources.