JSFiddle - React, Tailwind, and code Playground
by Axiniya
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poiret+One&display=swap" rel="stylesheet">
</head>
<body>
<div class="">
<a herf="#" id="Event"><span class="name">Ксения Беляева</span><span>Начинающий web-программист</span></a>
</div>
</body>
</html>
CSS
body {
font-family: 'Poiret One', cursive;
}
.name{
font-size: 30px;
font-weight: bold;
}
a {
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
position: relative;
margin: 20px auto;
width: 250px;
height: 150px;
background: white;
border-radius: 30px;
font-size: 15px;
letter-spacing: 1px;
transition: 1s box-shadow;
}
a:hover {
box-shadow: 0 5px 35px 0px rgba(0,0,0,.1);
color: #FDA8CF;
transition: 1s;
}
a:hover::before, a:hover::after {
display: block;
content: '';
position: absolute;
width: 250px;
height: 150px;
background: #FDA8CF;
border-radius: 30px;
z-index: -1;
animation: 1s clockwise infinite;
}
a:hover:after {
background: #F3CE5E;
animation: 2s counterclockwise infinite;
}
@keyframes clockwise {
0% {
top: -5px;
left: 0;
}
12% {
top: -2px;
left: 2px;
}
25% {
top: 0;
left: 5px;
}
37% {
top: 2px;
left: 2px;
}
50% {
top: 5px;
left: 0;
}
62% {
top: 2px;
left: -2px;
}
75% {
top: 0;
left: -5px;
}
87% {
top: -2px;
left: -2px;
}
100% {
top: -5px;
left: 0;
}
}
@keyframes counterclockwise {
0% {
top: -5px;
right: 0;
}
12% {
top: -2px;
right: 2px;
}
25% {
top: 0;
right: 5px;
}
37% {
top: 2px;
right: 2px;
}
50% {
top: 5px;
right: 0;
}
62% {
top: 2px;
right: -2px;
}
75% {
top: 0;
right: -5px;
}
87% {
top: -2px;
right: -2px;
}
100% {
top: -5px;
right: 0;
}
}
JavaScript
document.querySelector("#Event") .addEventListener("click", myFoo);
function myFoo() {
document.body.style.opacity = ('0');
}
document.onkeydown = function iziz(iz) {
if (iz.keyCode == '32') {
document.querySelector('#Event').remove();
}
};