Animated Button - "Realistic" Button

Sometimes it’s fun to be literal. These buttons mimic real-world keyboard keys and feature a satisfying “pressed” animation on hover. The effect is achieved with a carefully layered box-shadow. Each line in the box-shadow rule adds a separate shadow, slightly darker than the one before, to create a smooth, stacked shading effect beneath the button.
The box-shadow property can accept multiple shadows at once, separated by commas; I’ve written each shadow on its own line for readability. Each individual shadow rule creates a thin horizontal line of color, gradually building up a dimensional base. On hover, half of the lines are removed to simulate compression. The final shadow includes a blur radius to give a soft, realistic drop shadow.
A key challenge with this design is choosing the right color progression. You’ll need to start with the base color and gradually darken it with each successive shadow to achieve the smooth, layered shading effect. It can take a bit of trial and error, but the result is well worth it for a polished, dimensional look.
HTML:
Copy to clipboard<a href='#'><div id='button-example-1688'>Click here!</div></a>
CSS:
Copy to clipboard#button-example-1688 {
background-color: #AD665C; color: #fffff7; padding: 17px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center; margin-bottom: 10px; border-radius: 3px; box-shadow: inset 0 1px #A35B52, 0 1px #95544B, 0 2px #935148, 0 4px #8e4d44, 0 5px #894940, 0 6px #82443b, 0 6px 7px #7a3f37;
}#button-example-1688:hover {
transform: translateY(3px); box-shadow: inset 0 1px #A35B52, 0 1px #95544B, 0 2px #8e4d44, 0 3px #82443b, 0 4px 6px #7a3f37;
}

