Maison > Article > interface Web > 关于CSS3 transition-property问题_html/css_WEB-ITnose
css3动画效果
.transition{
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
这里我只想对transform属性生效如下:
-webkit-transform: translateX(20px);
需要怎么写啊?下面的写法没有生效啊!
-webkit-transition: transform .5s ease;
-webkit-transform
也要类似写法吧
div
{
transform: translate(50px,100px);
-ms-transform: translate(50px,100px); /* IE 9 */
-webkit-transform: translate(50px,100px); /* Safari and Chrome */
-o-transform: translate(50px,100px); /* Opera */
-moz-transform: translate(50px,100px); /* Firefox */
}
你似乎需要一个触发事件
CSS3 IE兼容代码在线转换 IE's CSS3 Transforms Translator
演示代码
.trans { width: 100px; height: 100px; background-color: yellow;}.trans:hover {/* W3C CSS3 standard */ transform: translateX(20px); /* Firefox */ -moz-transform: translateX(20px); /* webkit (Chrome, Safari, mobile browsers, etc) */ -webkit-transform: translateX(20px); /* Opera */ -o-transform: translateX(20px); /* IE>=9 */ -ms-transform: translateX(20px); /* IE8+ - must be on one line, unfortunately */ -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22=1, SizingMethod='auto expand')"; /* IE6 and 7 */ filter: progid:DXImageTransform.Microsoft.Matrix( M11=1, M12=0, M21=0, M22=1, SizingMethod='auto expand'); /* * To make the transform-origin be the middle of * the object. Note: These numbers * are approximations. For more accurate results, * use Internet Explorer with this tool. */ margin-left: 7px; margin-top: -3px; }
演示更新版
加上了transition