Hiệu ứng đẹp dùng ngày cho website (ok)
Last updated
Last updated
<div class="line"></div>
html, body {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background: #B24592;
background: linear-gradient(to left, #B24592 , #F15F79);
}
.line {
position: relative;
width: 400px;
height: 10px;
background: rgba(255, 255, 255, .1);
&:before {
animation: progress-1 4s infinite;
transform-origin: 0 0;
content: "";
display: block;
width: 400px;
height: 100%;
background: linear-gradient(to right, rgba(255,255,255,0.1) 10%, rgba(255,255,255,0.4) 80%, rgba(255,255,255,1));
}
&:after {
content: "";
position: absolute;
animation: progress-2 4s infinite;
transform-origin: 90% 50%;
margin-left: -24px;
top: -9px;
width: 40px;
height: 21px;
border-radius: 2px;
background: rgba(210,189,255,.55);
filter: blur(8px);
box-shadow: 0 0 10px 6px rgba(210,189,255,.4),
-20px 0 15px 4px rgba(210,189,255,.3),
-40px 0 15px 2px rgba(210,189,255,.2),
-60px 0 10px 1px rgba(210,189,255,.1),
-80px 0 10px 1px rgba(210,189,255,.05);
}
}
@keyframes progress-1 {
0% {
transform: scalex(0);
opacity: .5;
}
90% {
transform: scalex(1);
opacity: 1;
}
92% {
transform: scalex(1);
opacity: 1;
}
100% {
transform: scalex(1);
opacity: 0;
}
}
@keyframes progress-2 {
0% {
transform: scale(.3,.8) translatez(0);
opacity: 0;
}
90% {
transform: scale(1,1) translatex(400px) translatez(0);
opacity: 1;
}
100% {
transform: scale(1,1) translatex(400px) translatez(0);
opacity: 0;
}
}
https://codepad.co/snippet/minimal-buttons-smooth-hover-effect
<div class="wrapper">
<div class='button button__one'>
Hover Me!
</div>
<div class='button button__two'>
Hover Me Too!
</div>
</div>
* {
box-sizing: border-box;
}
html, body {
height: 100%;
width: 100%;
overflow: hidden;
background: #ddd6f3;
background: linear-gradient(to left, #E55D87 , #5FC3E4);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-family: sans-serif;
font-weight: 100;
font-size: 20px;
}
.wrapper {
display: flex;
flex-direction: column;
}
.button {
position: relative;
color: #444;
display: inline-block;
height: 60px;
line-height: 60px;
text-align: center;
transition: 0.5s;
padding: 0 20px;
cursor: pointer;
border: 2px solid #444;
margin-bottom: 20px;
}
.button:hover {
border: 2px solid rgba(0,160,80,0);
color: #FFF;
}
.button::before, .button::after {
width: 100%;
height:100%;
z-index: 3;
content:'';
position: absolute;
top:0;
left:0;
box-sizing: border-box;
transform: scale(0);
transition: 0.5s;
}
.button__one::before {
border-bottom: 3px solid #FFF;
border-left: 3px solid #FFF;
transform-origin: 0 100%;
}
.button__one::after {
border-top: 3px solid #FFF;
border-right: 3px solid #FFF;
transform-origin: 100% 0%;
}
.button__two::before {
border-bottom: 3px solid #FFF;
border-left: 3px solid #FFF;
transform-origin: 100% 0%;
}
.button__two::after {
border-top: 3px solid #FFF;
border-right: 3px solid #FFF;
transform-origin: 0% 100%;
}
.button:hover::after, .button:hover::before {
transform: scale(1);
}