gpt4 book ai didi

html - Css 转换在 Action View Rails 中不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 02:09:55 24 4
gpt4 key购买 nike

我一直在努力弄清楚为什么我的 css 转换不起作用。当我将鼠标悬停在按钮上时,我使用 hover.css 库来实现弹跳效果。但我的按钮似乎不适用于 Action View 语法。这是我的 ERB 代码

<h1>Goals</h1>
<div class="row">
<% @goals.each do |goal| %>
<div class="one-third column" style="border: solid 0.5px #555; border-radius:10px;padding: 20px;">
<h3><%= goal.title %></h3>
<p><%= goal.is_goal_validated %></p>
<p><%= goal.is_goal_completed %></p>
<p><%= button_to 'Pledge', goal, :method => :get, class: "hvr-bounce-to-right" %></p>
</div>
<% end %>
<button class="hvr-bounce-to-right">hi</button>
</div>

这是我的CSS代码

.hvr-bounce-to-right {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.5s;
transition-duration: 0.5s;
}
.hvr-bounce-to-right:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #2098d1;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transform-origin: 0 50%;
transform-origin: 0 50%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.5s;
transition-duration: 0.5s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.hvr-bounce-to-right:hover, .hvr-bounce-to-right:focus, .hvr-bounce-to-right:active {
color: white;
}
.hvr-bounce-to-right:hover:before, .hvr-bounce-to-right:focus:before, .hvr-bounce-to-right:active:before {
-webkit-transform: scaleX(1);
transform: scaleX(1);
-webkit-transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
}
<button class="hvr-bounce-to-right">hi</button>

问题是我的按钮 html 语法有效但不适用于操作 View 语法。任何帮助将不胜感激。

最佳答案

所以你上面的 CSS 样式似乎工作得很好至少对于 <button class="hvr-bounce-to-right">hi</button>

因此问题很可能是用于生成按钮的 ruby​​ 代码。您应该检查(并发布,就此而言)下一行生成的 html 源代码(我猜这会导致按钮不起作用)。

<%= button_to 'Pledge', goal, :method => :get, class: "hvr-bounce-to-right" %>

关于html - Css 转换在 Action View Rails 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39946036/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com