Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
kalp-lathia's hover button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By kalp-lathia
Button submission checks
Checks will appear after the preview updates.
Buttons only: no full pages, forms, cards or navigation. Put scripts in the JavaScript tab. Tailwind uses utilities from HTML and JavaScript; use complete class names. Custom CSS supports plain CSS, without @apply, imports or plugins.
Accessibility quick check
Waiting for the rendered preview…
Try Tab, Enter and Space in the preview. Check the focus ring, hover and disabled states, then enable Reduce motion. These checks are guidance, not an accessibility certification.
Explore freely here. Remix to publish your version with credit to the creator.
About kalp-lathia's hover button
kalp-lathia's hover button is an animated CSS button by kalp-lathia. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, Animated
- Using this example
- Copy the HTML or download index.html, style.css and app.js. Test keyboard focus, motion and contrast in your own project.
Usage, Tailwind and licensing questions
Read the source files
HTML
<button class="button">
<span class="left"></span>
<span>Hover Me</span>
<span class="right"></span>
</button>CSS
.button {
--bg-color: rgb(0, 119, 255);
--color: white;
--border-radius: 1rem;
--animation-duaration: 1s;
--height: 4rem;
--span-width: 1.5rem;
--base-pos: 0rem;
--final-pos: -2rem
}
.button, .left, .right {
height: var(--height);
background-color: var(--bg-color);
transition: all var(--animation-duaration) ease-in-out;
}
.button {
position: relative;
font-size: 1rem;
padding: 0rem 2.5rem;
color: var(--color);
border: none;
border-radius: var(--border-radius);
cursor: pointer;
}
.left, .right {
width: var(--span-width);
position: absolute;
top: 0rem;
}
.left {
left: var(--base-pos);
border-radius: var(--border-radius) 0rem 0rem var(--border-radius);
}
.right {
right: var(--base-pos);
border-radius: 0rem var(--border-radius) var(--border-radius) 0rem;
}
.button:hover {
animation: button-radius var(--animation-duaration) infinite ease-in-out;
}
.button:hover .left {
animation: left-shake var(--animation-duaration) infinite ease-in-out;
}
.button:hover .right {
animation: right-shake var(--animation-duaration) infinite ease-in-out;
}
@keyframes button-radius {
0% {
border-radius: var(--border-radius);
}
50% {
border-radius: 0rem;
}
100% {
border-radius: var(--border-radius);
}
}
@keyframes left-shake {
0% {
left: var(--base-pos);
}
50% {
left: var(--final-pos);
}
100% {
left: var(--base-pos);
}
}
@keyframes right-shake {
0% {
right: var(--base-pos);
}
50% {
right: var(--final-pos);
}
100% {
right: var(--base-pos);
}
}