google-chrome - Chrome 中的 CSS3 过渡错误会创建奇怪的背景颜色

标签 google-chrome css background-color transition

我试图通过实现 CSS3 的过渡属性在按钮上制作流畅的动画。在 FirefoxSafariOpera 中,按钮从深绿色平滑地变为浅绿色(IE 无论如何都不支持转换)。

但出于某种原因,在 Chrome 中,如果您将鼠标悬停在一个按钮上然后立即将鼠标悬停在另一个按钮上,颜色似乎会滞后。有时我得到一个霓虹绿按钮,有时我得到一个黑色按钮;每当我从一个按钮到下一个按钮运行鼠标速度过快时,就会发生一些事情。 Chrome 能否跟不上过渡或其他什么?

我正在使用的准系统代码:

.button {  
transition: background-color 0.2s;  
-moz-transition: background-color 0.2s;  
-webkit-transition: background-color 0.2s;  
background-color: #466b46; 
}

.button:hover {  
background-color: #74d06c;  
}

Chrome 的版本为 24.0.1312.56。任何帮助将不胜感激。

最佳答案

如果我清楚地理解您的问题,您希望在悬停按钮时在 chrome 中平滑过渡吗? 为此,请像这样更改您的代码:

.button {  
     transition: background-color linear 0.2s;  
     -moz-transition: background-color linear 0.2s;  
     -webkit-transition: background-color linear 0.2s;  
     background-color: #466b46; 
}

.button:hover {  
     transition: background-color linear 0.2s;  
     -moz-transition: background-color linear 0.2s;  
     -webkit-transition: background-color linear 0.2s;  
     background-color: #74d06c;  
}

使用此代码,如果您更改按钮上的悬停,您也可以平滑过渡到返回初始参数。

希望对您有所帮助。

关于google-chrome - Chrome 中的 CSS3 过渡错误会创建奇怪的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14544937/

相关文章:

围绕 Y 轴的 CSS 3D 旋转导致 Chrome 中旋转的内容闪烁

HTML/CSS <div> 不会低于另一个

html - 停止页面在 HTML/CSS 中向下滚动

ios - 为 iOS 应用程序中的所有 UITableViewCells 设置背景颜色

javascript - 如何使用 javascript 设置背景颜色和边框

SVG 元素的 CSS 动画在 Chrome 中不起作用

internet-explorer - 按浏览器版本阻止混合内容

javascript - 如何查找 Chrome 中调用方法的位置?

html - Main 从 body 继承宽度

html - ARGB 十六进制颜色在 css html 中不起作用