Today, I am going to show you how to create mirror shine effect on hover.
HTML
<div class="glass-shine-effect"></div>
Important thing to note is
:before
and:hover
styling.
SCSS
.glass-shine-effect {
background-color: rgba(255, 255, 255, 0.15);
box-shadow: 0 8px 32px 0 rgba(107, 107, 107, 0.37);
backdrop-filter: blur(6px); // Just for effect
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.18);
height: 125px;
width: 125px;
cursor: pointer;
position: relative;
transition: transform 200ms ease;
overflow: hidden;
&:before {
content: "";
position: absolute;
height: 150%;
width: 50px;
transform: rotate(30deg);
background-color: rgba(255, 255, 255, 0.2);
left: -100px;
}
&:hover {
transform: scale(1.1);
&:before {
transition: left 500ms ease;
left: 170px;
}
}
}
CSS
.glass-shine-effect {
background-color: rgba(255, 255, 255, 0.15);
box-shadow: 0 8px 32px 0 rgba(107, 107, 107, 0.37);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.18);
display: flex;
justify-content: center;
align-items: center;
height: 125px;
width: 125px;
cursor: pointer;
position: relative;
transition: transform 200ms ease;
overflow: hidden;
}
.glass-shine-effect:before {
content: "";
position: absolute;
height: 150%;
width: 50px;
transform: rotate(30deg);
background-color: rgba(255, 255, 255, 0.2);
left: -100px;
}
.glass-shine-effect:hover {
transform: scale(1.1);
}
.glass-shine-effect:hover:before {
transition: left 500ms ease;
left: 170px;
}
That's it. You can check out working demo here on codepen.
Top comments (0)