Animated Button - Color Bar with Slide on Hover

This button uses an inset box-shadow to create a bold band of contrasting color on the right side. This color band slides over on hover to cover the whole button. It’s a clean, modern look - more akin to a tab than a traditional button, but still sharp and professional.

Here's a breakdown of what is going on with the box-shadow:

  • inset - renders the shadow inside the element, rather than outside.
  • 10px - the horizontal offset (or width of the inset bar in this case). On hover, it increases to the width of the button, creating a complete fill.
  • 0 - the vertical offset; since it's zero, the shadow only appears as a vertical bar on the right side.
  • #A3C09B - the solid color used for the inset fill.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-1607'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-1607 {

color: #fffff7; background-color: #373936; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center; box-shadow: inset 10px 0 #A3C09B; transition: ease-out 0.5s;

}

#button-example-1607:hover {

box-shadow: inset 280px 0 #A3C09B; color: #373936;

}

Pumpkins n' Pies

For gluten-free baking enthusiasts and garden lovers: discover delicious, from-scratch recipes featuring sourdough, whole foods, and most importantly – pie! Explore gardening tips from central Illinois, along with a byte of code for fellow developers.
 © 2026 Abhishek & Miriam Chaturvedi