Красивый неоновый hover-эффект при наведении на кнопку
На чтение 2 мин. Просмотров 1.6k. Опубликовано
Обновлено
HTML
<div class="bouton">
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Button
</a>
</div>
CSS
@import url("https://fonts.googleapis.com/css2?family=Questrial&display=swap");
/************************************************
1. BODY
************************************************/
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 100vh;
background-color: #050f1a;
font-family: "Questrial", Impact, sans-serif;
}
/************************************************
2. LIEN et BOUTON
************************************************/
a {
position: relative;
display: inline-block;
padding: 15px 30px;
color: #00fff6;
text-transform: uppercase;
letter-spacing: 3px;
text-decoration: none;
font-size: 30px;
overflow: hidden;
transition: 0.2s;
}
a:visited {
color: #00fff6;
}
a:hover {
color: #050f1a;
background: #00fff6;
border-radius: 3px;
box-shadow: 0 0 10px #00fff6, 0 0 40px #00fff6, 0 0 80px #00fff6;
transition-delay: 600ms;
}
a span {
position: absolute;
display: block;
}
/************************************************
3. NEON DU HAUT
************************************************/
a span:nth-child(1) {
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #00fff6);
}
a:hover span:nth-child(1) {
left: 100%;
transition: 600ms;
}
/************************************************
4. NEON DU BAS
************************************************/
a span:nth-child(3) {
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #00fff6);
}
a:hover span:nth-child(3) {
right: 100%;
transition: 1s;
transition-delay: 250ms;
}
/************************************************
5. NEON DE DROITE
************************************************/
a span:nth-child(2) {
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #00fff6);
}
a:hover span:nth-child(2) {
top: 100%;
transition: 1s;
transition-delay: 100ms;
}
/************************************************
5. NEON DE GAUCHE
************************************************/
a span:nth-child(4) {
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #00fff6);
}
a:hover span:nth-child(4) {
bottom: 100%;
transition: 1s;
transition-delay: 450ms;
}
Источник
( 1 оценка, среднее 5 из 5 )