【问题标题】:Making CSS transition effects work in all browsers使 CSS 过渡效果适用于所有浏览器
【发布时间】:2012-06-27 12:18:39
【问题描述】:

我目前有以下 CSS,它适用于 Google Chrome (Webkit),但不适用于任何其他浏览器。

什么是使它与所有东西兼容的最佳方法?

如您所见,它使用的是 webkit,但我不确定 moz 等价物是什么。

非常感谢

.card{
    margin-top: -50px;
}

.card {
    width: 286px; height: 224px;
    -webkit-transform-style: preserve-3d;
    -webkit-transition: 0.5s;
    -moz-transform-style: preserve-3d;
    -moz-transition: 0.5s;
}
    .container:hover .card {
        -webkit-transform: rotateY(180deg); 
        -moz-transform: rotateY(180deg);                

    }

.face {
    position: absolute;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
}


.megatron {
    float: left; top: 30px;
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
}
    .megatron .front {

    }
    .megatron .back {
        -webkit-transform: rotateY(180deg);
        -moz-transform: rotateY(180deg);

    }
        .megatron .back h2 {
            background: url(megatron-title.png); text-indent: -9999px; 
        }
        .megatron img {
            float: right;
        }

【问题讨论】:

  • 与其手动编写,不如尝试使用CSS3 Generator之类的工具
  • 您是否尝试查找 -moz 等效项?

标签: firefox google-chrome css compatibility


【解决方案1】:

您的基本跨浏览器 CSS3 过渡声明:

-webkit-transition: all 500ms ease;
-moz-transition: all 500ms ease;
-ms-transition: all 500ms ease;
-o-transition: all 500ms ease;
transition: all 500ms ease;

这是我最喜欢的帮助加快流程的工具之一:http://css3generator.com/

【讨论】:

    【解决方案2】:

    也许你需要:

    -webkit-...  // For Webkit browser(Chrome, Safari...)
    -moz-...     // For Mozilla browser
    -o-...       // For Opera browser
    -ms-...      // For Microsoft browser
    none...      // For all browser(Newest version)
    

    示例:

    -webkit-transition: 3s ease;
    -moz-transition: 3s ease;
    -o-transition: 3s ease;
    -ms-transition: 3s ease;
    transition: 3s ease;
    

    希望有用。

    【讨论】:

      猜你喜欢
      • 2013-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-22
      • 2011-08-04
      • 2011-06-20
      • 2023-03-26
      • 2010-11-04
      相关资源
      最近更新 更多