Animated Border Effect

Animated Border Effect Code:

1.index.html:

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Animated Border Effect</title> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/fontawesome.min.css"> </head> <body> <a href="#"><svg xmlns="http://www.w3.org/2000/svg" width="125" height="125" fill="currentColor" class="bi bi-balloon-heart" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="m8 2.42-.717-.737c-1.13-1.161-3.243-.777-4.01.72-.35.685-.451 1.707.236 3.062C4.16 6.753 5.52 8.32 8 10.042c2.479-1.723 3.839-3.29 4.491-4.577.687-1.355.587-2.377.236-3.061-.767-1.498-2.88-1.882-4.01-.721L8 2.42Zm-.49 8.5c-10.78-7.44-3-13.155.359-10.063.045.041.089.084.132.129.043-.045.087-.088.132-.129 3.36-3.092 11.137 2.624.357 10.063l.235.468a.25.25 0 1 1-.448.224l-.008-.017c.008.11.02.202.037.29.054.27.161.488.419 1.003.288.578.235 1.15.076 1.629-.157.469-.422.867-.588 1.115l-.004.007a.25.25 0 1 1-.416-.278c.168-.252.4-.6.533-1.003.133-.396.163-.824-.049-1.246l-.013-.028c-.24-.48-.38-.758-.448-1.102a3.177 3.177 0 0 1-.052-.45l-.04.08a.25.25 0 1 1-.447-.224l.235-.468ZM6.013 2.06c-.649-.18-1.483.083-1.85.798-.131.258-.245.689-.08 1.335.063.244.414.198.487-.043.21-.697.627-1.447 1.359-1.692.217-.073.304-.337.084-.398Z"/> </svg></a> </body> </html>

2.style.css:

body { margin: 0; padding: 0; background: black; } a { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: white; font-size: 80px; text-decoration: none; width: 140px; height: 80px; border: 2px solid transparent; text-align: center; line-height: 80px; transition: 0.5s; } a::before, a::after { content: ''; width: 100%; height: 100%; position: absolute; top: -2px; left: -2px; border: 2px solid transparent; transform: rotate(0deg); transition: 0.5s; } a:hover { border: 2px solid white; border-top: 2px solid transparent; border-bottom: 2px solid transparent; } a:hover::before { transform: rotate(120deg); border: 2px solid white; border-top: 2px solid transparent; border-bottom: 2px solid transparent; } a:hover::after { transform: rotate(-120deg); border: 2px solid white; border-top: 2px solid transparent; border-bottom: 2px solid transparent; }

Оставьте комментарий

Ваш адрес email не будет опубликован.