css - CSS3 中的过渡在 Firefox 或 Internet Explorer 中不起作用

标签 css internet-explorer firefox css-transitions

我正在创建一个小型企业页面。我有一个为导航按钮创建的背景图像。我希望它们在悬停在图像上时具有过渡效果。它适用于 Chrome,但我不明白为什么我的代码无法在 Firefox 或 Internet Explorer 中运行。

.nav li a.active {
    background-image: url('../images/02amainhover.png');
    background-color: transparent;
    background-repeat: no-repeat;
    background-attachment: center center;
    width: 245px;
    height: 74px;
    left: 72px;
    top: 432px;
    position: fixed;
    transition: all .8s ease-out;
    -moz-transition: all .8s ease-out;
}
.nav li a.active:hover {
    background-image: url('../images/03amainhover.png');
    background-color: transparent;
    background-repeat: no-repeat;
    background-attachment: center center;
    width: 245px;
    height: 74px;
    left: 72px;
    top: 432px;
    position: fixed;
    transition: all .8s ease-in;
    -moz-transition: all .8s ease-in;
}

最佳答案

几件事。首先是你有太多重复的代码。在您告诉它更改代码之前,网站会采用相同的代码,因此复制所有这些样式毫无意义。你只需要用你想要转换的东西来更新它。也就是说,您不能转换背景图像。请引用此列表以了解过渡样式:https://www.w3.org/TR/css3-transitions/#animation-of-property-types-

关于css - CSS3 中的过渡在 Firefox 或 Internet Explorer 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38923129/

相关文章:

javascript - 禁用时如何更改material-ui slider 拇指样式

css - IE7 中奇怪的 CSS 问题

javascript - 页面内容不会在 Internet Explorer 中刷新(仅在浏览器重新打开后)

CSS 在 Chrome 中不工作,在 firefox 中不工作

javascript - 在 <audio> 元素上设置 currentTime 会使 Firefox 崩溃

css - SASS:从列表中随机选择背景图像

html - <div> 中的背景图片仅使用 CSS

css - 交叉淡入淡出动画在 Firefox、IE 或 Opera 中不起作用

html - Firebug 无法加载给定的 url

html - 为什么我的拇指在使用谷歌浏览器时消失了?