CSS mozilla 过渡不起作用

标签 css

我有一个简单的过渡,可以在平滑悬停时将页脚 img 向上移动 5px,但是 Firefox 不应用平滑过渡。只有 webkit。

我已经如下正确声明了所有供应商前缀。

    #footer img {
        margin-left:8px;
        -webkit-transition:all .1s ease;
        -moz-transition:all .1s ease;
        -ms-transition:all .1s ease;
        transition:all .1s ease;
        cursor:pointer;

#footer img:hover {
    position:relative;
    top:-5px;

您可以在 Safari/Chrome VS Firefox 中自行检查。转到页脚并将鼠标悬停在每个元素上。

www.rjam.es

最佳答案

Firefox 似乎需要先设置一个初始值。即使它是 0

#footer img {
     margin-left:8px;
     -webkit-transition:all .1s ease;
     -moz-transition:all .1s ease;
     -ms-transition:all .1s ease;
     transition:all .1s ease;
     cursor:pointer;
     position:relative;
     top:0;
}

#footer img:hover {
     top:-5px;
}

关于CSS mozilla 过渡不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8248948/

相关文章:

jquery - 我们如何使用 css3 更改复选框和单选框的背景颜色?

html - 如何从一页中删除 Wordpress 标题?

css - 导航栏上的下拉菜单位于其他组件下方

android - Android 上的 Chrome 调整字体大小

javascript - JS 鼠标悬停功能在我悬停特定 div 时不重置

html - float 右上角和左上角和自动换行

javascript - 在 Angular2 中设置背景并将封装设置为无

javascript - 使用 Materialize 添加自定义样式以响应元素

css - 水平元素的响应流困境

html - 无法在 Cocoa 的 HTML webview 中设置表格的最大宽度