【问题标题】:transition on transform property in short code短代码中转换属性的转换
【发布时间】:2017-05-31 15:32:22
【问题描述】:

我很困惑如何正确编写这段代码?

选项 1:

.line-all {
  -webkit-transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
  transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
}

.animated .line-all {
  -ms-transform: translate(0px, 3px) rotate(-45deg);
  -webkit-transform: translate(0px, 3px) rotate(-45deg);
  transform: translate(0px, 3px) rotate(-45deg);
}

选项 2:

.line-all {
  -webkit-transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99), -webkit-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99), -ms-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
  transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99), -webkit-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99), -ms-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
}

.animated .line-all {
  -ms-transform: translate(0px, 3px) rotate(-45deg);
  -webkit-transform: translate(0px, 3px) rotate(-45deg);
  transform: translate(0px, 3px) rotate(-45deg);
}

选项 3:

.line-all {
  -webkit-transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99), -webkit-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99), -ms-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
  transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
}

.animated .line-all {
  -ms-transform: translate(0px, 3px) rotate(-45deg);
  -webkit-transform: translate(0px, 3px) rotate(-45deg);
  transform: translate(0px, 3px) rotate(-45deg);
}

还有其他写法吗?或者从上面 3 中选择哪一个是正确的?

【问题讨论】:

    标签: css css-transitions css-transforms


    【解决方案1】:

    刚刚得到我的答案,并且工作也很好

    .line-all {
      -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
      transition: transform 0.4s cubic-bezier(0.4, 0.01, 0.165, 0.99);
    }
    
    .animated .line-all {
      -ms-transform: translate(0px, 3px) rotate(-45deg);
      -webkit-transform: translate(0px, 3px) rotate(-45deg);
      transform: translate(0px, 3px) rotate(-45deg);
    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-27
      • 1970-01-01
      • 2018-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-01
      • 1970-01-01
      相关资源
      最近更新 更多