Created
April 30, 2024 08:13
-
-
Save geekelo/4ffcd5d1d7786746d86e99a7eabd6991 to your computer and use it in GitHub Desktop.
Snippet to display border buttom sliding from left toright
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.nav-links { | |
text-decoration: none; | |
color: grey; | |
margin: 1rem 1.5rem; | |
font-size: 1.1rem; | |
font-weight: bold; | |
position: relative; /* Ensure proper positioning of pseudo-element */ | |
} | |
.nav-links::before { | |
content: ''; | |
position: absolute; | |
bottom: 0; | |
left: 0; | |
width: 0; /* Start with no width */ | |
height: 3px; /* Border thickness */ | |
background-color: #431695; | |
transition: width 0.5s ease; /* Transition width property for fade-in effect */ | |
} | |
.nav-links.active::before, | |
.nav-links:hover::before { | |
width: 100%; /* Set width to 100% to fade in from left to right */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment