CSS背景颜色过渡不起作用

时间:2012-03-20 05:13:05

标签: css background-color css-transitions

使用以下规则和样式声明

.tableRow.even, .tableRowNS.even, .odd   { background-color: #F2F2F2; }
.tableRow.odd, .tableRowNS.odd, .even   { background-color: white; }

.tableRow:hover,.noProject:hover,
.tableRow.even:hover, .tableRowNS.even:hover, .odd:hover,
.tableRow.odd:hover, .tableRowNS.odd:hover, .even:hover {
    background-color: #E8E8E8;
    transition: background-color .5s;
    -webkit-transition: background-color .5s;
    -o-transition: background-color .5s;
}
  1. 鼠标悬停颜色正在运行,但它没有过渡。我接近这个错误吗?
  2. 在像这样的多个选择器上设置过渡属性是否有问题?

1 个答案:

答案 0 :(得分:2)

我忘了添加firefox特定的css3过渡属性:-moz-transition

添加之后,我们有以下css。现在一切正常。

.tableRow:hover,.noProject:hover,
.tableRow.even:hover, .tableRowNS.even:hover, .odd:hover,
.tableRow.odd:hover, .tableRowNS.odd:hover, .even:hover {
    background-color: #E8E8E8;
    transition: background-color .5s;
    -webkit-transition: background-color .5s;
    -o-transition: background-color .5s;
    -moz-transition: background-color .5s;
}