Back to buttons

Live preview

Preview settings

Changes appear as you type. Use Tab to test keyboard focus.

⌘ / Ctrl + S saves locally

nima-mollazadeh's hover button

HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.

By nima-mollazadeh

Remix button

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 nima-mollazadeh's hover button

nima-mollazadeh's hover button is an animated CSS button by nima-mollazadeh. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.

Effects and categories
Hover effects, 3D
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

<div class="back">
  <div class="button_base b_3d">
    <div>button</div>
    <div>button</div>
    <div>button</div>
    <div>button</div>
  </div>
</div>

CSS


.button_base {
  margin: 0;
  border: 0;
  font-size: 18px;
  position: relative;
  top: 50%;
  left: 50%;
  margin-top: -25px;
  margin-left: -100px;
  width: 200px;
  height: 50px;
  text-align: center;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  cursor: default;
}

.button_base:hover {
  cursor: pointer;
}

.b_3d {
  perspective: 500px;
  -webkit-perspective: 500px;
  -moz-perspective: 500px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.b_3d div {
  position: absolute;
  text-align: center;
  padding: 10px;
  border: #000000 solid 1px;
  pointer-events: none;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}

.b_3d div:nth-child(1) {
  color: #ffffff;
  background-color: #7c00fe;
  z-index: 0;
  width: 100%;
  height: 50px;
  clip: rect(0px, 100px, 50px, 0px);
  position: absolute;
  transition: all 0.2s ease;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  transform: rotateX(0deg);
  -webkit-transform: rotateX(0deg);
  -moz-transform: rotateX(0deg);
  transform-origin: 50% 50% -25px;
  -webkit-transform-origin: 50% 50% -25px;
  -moz-transform-origin: 50% 50% -25px;
}

.b_3d div:nth-child(2) {
  color: #000000;
  background-color: #f9e400;
  z-index: -1;
  width: 100%;
  height: 50px;
  clip: rect(0px, 100px, 50px, 0px);
  position: absolute;
  transform: rotateX(90deg);
  -webkit-transform: rotateX(90deg);
  -moz-transform: rotateX(90deg);
  transition: all 0.2s ease;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  transform-origin: 50% 50% -25px;
  -webkit-transform-origin: 50% 50% -25px;
  -moz-transform-origin: 50% 50% -25px;
}

.b_3d div:nth-child(3) {
  color: #000000;
  background-color: #f9e400;
  z-index: 0;
  width: 100%;
  height: 50px;
  clip: rect(0px, 200px, 50px, 100px);
  position: absolute;
  transition: all 0.2s ease 0.1s;
  -webkit-transition: all 0.2s ease 0.1s;
  -moz-transition: all 0.2s ease 0.1s;
  transform: rotateX(0deg);
  -webkit-transform: rotateX(0deg);
  -moz-transform: rotateX(0deg);
  transform-origin: 50% 50% -25px;
  -webkit-transform-origin: 50% 50% -25px;
  -moz-transform-origin: 50% 50% -25px;
}

.b_3d div:nth-child(4) {
  color: #ffffff;
  background-color: #7c00fe;
  z-index: -1;
  width: 100%;
  height: 50px;
  clip: rect(0px, 200px, 50px, 100px);
  position: absolute;
  transform: rotateX(-90deg);
  -webkit-transform: rotateX(-90deg);
  -moz-transform: rotateX(-90deg);
  transition: all 0.2s ease 0.1s;
  -webkit-transition: all 0.2s ease 0.1s;
  -moz-transition: all 0.2s ease 0.1s;
  transform-origin: 50% 50% -25px;
  -webkit-transform-origin: 50% 50% -25px;
  -moz-transform-origin: 50% 50% -25px;
}

.b_3d:hover div:nth-child(1) {
  background-color: #7c00fe;
  transition: all 0.2s ease;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  transform: rotateX(-90deg);
  -webkit-transform: rotateX(-90deg);
  -moz-transform: rotateX(-90deg);
}

.b_3d:hover div:nth-child(2) {
  color: #000000;
  transition: all 0.2s ease;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  transform: rotateX(0deg);
  -webkit-transform: rotateX(0deg);
  -moz-transform: rotateX(0deg);
}

.b_3d:hover div:nth-child(3) {
  background-color: #f9e400;
  transition: all 0.2s ease 0.1s;
  -webkit-transition: all 0.2s ease 0.1s;
  -moz-transition: all 0.2s ease 0.1s;
  transform: rotateX(90deg);
  -webkit-transform: rotateX(90deg);
  -moz-transform: rotateX(90deg);
}

.b_3d:hover div:nth-child(4) {
  color: #ffffff;
  transition: all 0.2s ease 0.1s;
  -webkit-transition: all 0.2s ease 0.1s;
  -moz-transition: all 0.2s ease 0.1s;
  transform: rotateX(0deg);
  -webkit-transform: rotateX(0deg);
  -moz-transform: rotateX(0deg);
}

.back {
  height: 200px;
  float: left;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  counter-increment: bc;
  padding: 0px 5px 5px 5px;
}