html - CSS : the center of the button stop the hover function

标签 html css hover

我创建了一个按钮,但是当我将鼠标放在它上面时,悬停效果消失了。 有人可以给我建议/解决方案吗?

/* spinner style */

.spinner {
  position: relative;
  width: 50px;
  height: 50px;
}

.spinner:before,
.spinner:after {
  content: "";
  display: block;
  position: absolute;
  border-width: 1px;
  border-style: solid;
  border-radius: 50%;
}

.spinner-block {
  border: 2px solid #ccc;
  !important;
  border-radius: 50px!important;
  width: 91px;
  height: 91px;
}


/* spinners styles */

@-webkit-keyframes rotate-animation {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes rotate-animation {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@-webkit-keyframes anti-rotate-animation {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(-360deg);
    transform: rotate(-360deg);
  }
}

@keyframes anti-rotate-animation {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(-360deg);
    transform: rotate(-360deg);
  }
}

.spinner.spinner-0:before {
  display: none;
}

.spinner.spinner-0:after {
  width: 15px;
  height: 15px;
  border-bottom-color: #cccccc;
  border-right-color: #cccccc;
  border-top-color: #cccccc;
  border-left-color: #cccccc;
  top: -14px;
  left: 34px;
  background-color: #cccccc;
}


/**vert**/

.spinner.spinner-2:before {
  width: 65px;
  height: 65px;
  border-bottom-color: #00ff10;
  border-right-color: #00ff10;
  border-top-color: rgba(33, 33, 33, 0);
  border-left-color: rgba(33, 33, 33, 0);
  top: 9px;
  left: 10px;
  -webkit-animation: anti-rotate-animation 0s linear 0s infinite;
  animation: anti-rotate-animation 0s linear 0s infinite;
}


/**jaune**/

.spinner.spinner-2:after {
  width: 40px;
  height: 40px;
  border-bottom-color: #dafc29;
  border-right-color: #dafc29;
  border-top-color: rgba(33, 33, 33, 0);
  border-left-color: rgba(33, 33, 33, 0);
  top: 22px;
  left: 22px;
  -webkit-animation: rotate-animation 0s linear 0s infinite;
  animation: rotate-animation 0s linear 0s infinite;
}

* {
  box-sizing: border-box;
}

.spinners {
  width: 92px;
  height: 92px;
  transition: transform .8s!important;
}


/**HOVER**/


/**vert**/

.spinner.spinner-2:hover::before {
  kit-animation: anti-rotate-animation 2.85s linear 0s infinite;
  animation: anti-rotate-animation 2.85s linear 0s infinite;
}


/**jaune**/

.spinner.spinner-2:hover::after {
  -webkit-animation: rotate-animation 1s linear 0s infinite;
  animation: rotate-animation 1s linear 0s infinite;
}
<a href="/our-clean-technology/">
  <div class="spinners">

    <div class="spinner-block">
      <div class="spinner spinner-2"></div>
      <div class="spinner spinner-0"></div>
    </div>
  </div>
</a>

最佳答案

像这样改变CSS

.spinners:hover .spinner-2::before {
    kit-animation: anti-rotate-animation 2.85s linear 0s infinite;
    animation: anti-rotate-animation 2.85s linear 0s infinite;
}


.spinners:hover .spinner-2::after {
    -webkit-animation: rotate-animation 1s linear 0s infinite;
    animation: rotate-animation 1s linear 0s infinite;
}

更新的笔是here

关于html - CSS : the center of the button stop the hover function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52622352/

相关文章:

html - 使用 Bootstrap 类,为什么我的子 div 在父级之外流动,而​​不是只占用剩余的高度?

javascript - 使用负 scrollTop/scrollLeft 值进行动画处理

asp.net - ASP.NET 中 CSS 中图像文件夹的路径

html - 带有顶部三 Angular 形的下拉菜单

CSS 导航菜单——悬停状态为父 UL 高度的 100%

jQuery Target 类分开

jquery - 粘性菜单 - 如何让图像在 "sticks"时立即显示?

javascript - 将 div 设为其内容宽度的 50%

javascript - 一定数量的 px 后边距底部不动

html - 使用 css 缩放图像