<input type="checkbox" id="like"><label for="like"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg></label>
body {
margin: 160px;
display: flex;
align-items: center;
justify-content: center;
}
input[type="checkbox"] {
display: none;
}
label {
position: relative;
cursor: pointer;
}
label svg {
width: 160px;
}
input[type="checkbox"] + label svg {
fill: #FAE2E2;
transition: all .3s;
}
input[type="checkbox"]:checked + label svg {
fill: #FA9797;
animation: like .8s ease-out;
transition: all .3s;
}
@keyframes like {
0% {
transform: scale(1,1);
}
50% {
transform: scale(.5,.5);
}
100% {
transform: scale(1,1);
}
}
input[type="checkbox"]:checked + label::after {
content: "";
position: absolute;
width: 160px;
height: 160px;
border: 5px solid #FA9797;
border-radius: 50%;
animation: circle .8s ease-out;
opacity: 0;
top: -10px;
left: -4px;
z-index: -100;
}
@keyframes circle {
0% {
transform: scale(.2,.2);
}
50% {
transform: scale(.5,.5);
}
80% {
transform: scale(1,1);
opacity: .8;
}
100% {
transform: scale(1.3,1.3);
opacity: 0;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.