CSS кнопка с эффектом анимации неонового света
- Последнее обновление: 3 Ноября 2023 г.
- Просмотры: 166
- Автор: Админ

Коллеги всем привет.
В сегодняшнем примере мы создадим на чистом CSS без использования JavaScript кода красивую кнопку с эффектом анимации неонового света.
HTML Код:
<body>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Button
</a>
</body>
CSS Код:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #112233;
}
a {
position: relative;
display: inline-block;
padding: 30px 45px;
color: #4CD4B0;
text-transform: uppercase;
letter-spacing: 5px;
text-decoration: none;
font-size: 25px;
overflow: hidden;
transition: 0.2s;
}
a:hover {
color: #27AE60;
background-color: #4CD4B0;
box-shadow: 0 0 10px #4CD4B0, 0 0 40px #4CD4B0, 0 0 80px #4CD4B0;
transition-delay: 1s;
}
a span{
position: absolute;
display: block;
}
a span:nth-child(1){
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #4CD4B0);
}
a:hover span:nth-child(1){
left: 100%;
transition: 1s;
}
a span:nth-child(3){
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #4CD4B0);
}
a:hover span:nth-child(3){
right: 100%;
transition: 1s;
transition-delay: 0.5s;
}
a span:nth-child(2){
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #4CD4B0);
}
a:hover span:nth-child(2){
top: 100%;
transition: 1s;
transition-delay: 0.25s;
}
a span:nth-child(4){
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #4CD4B0);
}
a:hover span:nth-child(4){
bottom: 100%;
transition: 1s;
transition-delay: 0.75s;
}
Всем спасибо, я надеюсь что вам моя статья хоть чем-то помогла.