Skip to content

Instantly share code, notes, and snippets.

@widoz
Created February 24, 2026 16:37
Show Gist options
  • Select an option

  • Save widoz/ac57fa86a71944615976ea617ee3e457 to your computer and use it in GitHub Desktop.

Select an option

Save widoz/ac57fa86a71944615976ea617ee3e457 to your computer and use it in GitHub Desktop.
Render the underline border with loop animation on hover
@mixin animate-border-bottom-on-hover-loop() {
position: relative;
&::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: 1px;
border-bottom: 1px solid currentColor;
}
&::after {
content: '';
position: absolute;
bottom: 0;
left: auto;
right: 0;
width: 100%;
height: 1px;
border-bottom: 1px solid currentColor;
}
&:hover {
&::before {
animation: by-zero-to-full-width var(--wp--custom--transition--duration) ease-out var(--wp--custom--transition--duration) both;
}
&::after {
animation: by-full-width-to-zero var(--wp--custom--transition--duration) ease-in both;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment