草庐IT

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

coder 2023-08-11 原文

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

/* 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 - CSS : the center of the button stop the hover function的更多相关文章

  1. ruby - 使用 ruby​​ 将 HTML 转换为纯文本并维护结构/格式 - 2

    我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h

  2. ruby - capybara field.has_css?匹配器 - 2

    我在MiniTest::Spec和Capybara中使用以下规范:find_field('Email').must_have_css('[autofocus]')检查名为“电子邮件”的字段是否具有autofocus属性。doc说如下:has_css?(path,options={})ChecksifagivenCSSselectorisonthepageorcurrentnode.据我了解,字段“Email”是一个节点,因此调用must_have_css绝对有效!我做错了什么? 最佳答案 通过JonasNicklas得到了答案:No

  3. ruby-on-rails - Rails HTML 请求渲染 JSON - 2

    在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这

  4. ruby-on-rails - 使用 Sublime Text 3 突出显示 HTML 背景语法中的 ERB? - 2

    所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择

  5. ruby-on-rails - Ruby url 到 html 链接转换 - 2

    我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.

  6. ruby-on-rails - capybara ::ElementNotFound:无法找到 xpath "/html" - 2

    我正在学习http://ruby.railstutorial.org/chapters/static-pages上的RubyonRails教程并遇到以下错误StaticPagesHomepageshouldhavethecontent'SampleApp'Failure/Error:page.shouldhave_content('SampleApp')Capybara::ElementNotFound:Unabletofindxpath"/html"#(eval):2:in`text'#./spec/requests/static_pages_spec.rb:7:in`(root)'

  7. css - 用 watir 检查标签类? - 2

    我有一个div,它根据表单是否正确提交而改变。我想知道是否可以检查类的特定元素?开始元素看起来像这样。如果输入不正确,添加错误类。 最佳答案 试试这个:browser.div(:id=>"myerrortest").class_name更多信息:http://watir.github.com/watir-webdriver/doc/Watir/HTMLElement.html#class_name-instance_method另一种选择是只查看具有您期望的类的div是否存在browser.div((:id=>"myerrortes

  8. ruby - 如何使用 Ruby 将 CSV 文件读入 HTML 表格? - 2

    我正在尝试将一个简单的CSV文件读入HTML表格以在浏览器中显示,但我遇到了麻烦。这就是我正在尝试的:Controller:defshow@csv=CSV.open("file.csv",:headers=>true)end查看:输出:NameStartDateEndDateQuantityPostalCode基本上我只获取标题,而不会读取和呈现CSV正文。 最佳答案 这最终成为最终解决方案:Controller:defshow#OpenaCSVfile,andthenreaditintoaCSV::Tableobjectforda

  9. ruby - 如何使用 Nokogiri 解析纯 HTML 表格? - 2

    我想用Nokogiri解析HTML页面。页面的一部分有一个表,它没有使用任何特定的ID。是否可以提取如下内容:Today,3,455,34Today,1,1300,3664Today,10,100000,3444,Yesterday,3454,5656,3Yesterday,3545,1000,10Yesterday,3411,36223,15来自这个HTML:TodayYesterdayQntySizeLengthLengthSizeQnty345534345456563113003664354510001010100000344434113622315

  10. ruby-on-rails - 连接字符串时如何在 <%=%> block 内输出 html_safe? - 2

    考虑一下:现在这些情况:#output:http://domain.com/?foo=1&bar=2#output:http://domain.com/?foo=1&bar=2#output:http://domain.com/?foo=1&bar=2#output:http://domain.com/?foo=1&bar=2我需要用其他字符串输出URL。我如何保证&符号不会被转义?由于我无法控制的原因,我无法发送&。求助!把我的头发拉到这里:\编辑:为了澄清,我实际上有一个像这样的数组:@images=[{:id=>"fooid",:url=>"http://

随机推荐